Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sun, 3 Aug 2008 21:14:10 +0000 (14:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Aug 2008 21:14:10 +0000 (14:14 -0700)
* maint:
git-name-rev: don't use printf without format

1  2 
builtin-name-rev.c
diff --combined builtin-name-rev.c
index 7055ac3108c5ce815728dce0127639170acfaf98,5352bc87b9ab5177922039cfec48a2fda8bd50a6..08c8aabf9428447abad7def693d7b22c5330e180
@@@ -172,7 -172,7 +172,7 @@@ static void show_name(const struct obje
  }
  
  static char const * const name_rev_usage[] = {
 -      "git-name-rev [options] ( --all | --stdin | <commit>... )",
 +      "git name-rev [options] ( --all | --stdin | <commit>... )",
        NULL
  };
  
@@@ -189,6 -189,7 +189,7 @@@ static void name_rev_line(char *p, stru
                        unsigned char sha1[40];
                        const char *name = NULL;
                        char c = *(p+1);
+                       int p_len = p - p_start + 1;
  
                        forty = 0;
  
                        if (!name)
                                continue;
  
-                       if (data->name_only) {
-                               fwrite(p_start, p - p_start + 1 - 40, 1, stdout);
-                               printf(name);
-                       } else {
-                               fwrite(p_start, p - p_start + 1, 1, stdout);
-                               printf(" (%s)", name);
-                       }
+                       if (data->name_only)
+                               printf("%.*s%s", p_len - 40, p_start, name);
+                       else
+                               printf("%.*s (%s)", p_len, p_start, name);
                        p_start = p + 1;
                }
        }