summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-03 14:14:10 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-03 14:14:10 -0700
commit57b0fc4516249e1aa86169718d148fbf2940dc0c (patch)
tree63c52b440c4a78bed607de408d811f6098f19cb1
parent6612f877cc94e80cd0c7393a8ea6bfea69146b3c (diff)
parent7c5b1675a88a52be1822129e4aa915c5531f6700 (diff)
downloadgit-57b0fc4516249e1aa86169718d148fbf2940dc0c.tar.gz
Merge branch 'maint'
* maint: git-name-rev: don't use printf without format
-rw-r--r--builtin-name-rev.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 7055ac3108..08c8aabf94 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -189,6 +189,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
unsigned char sha1[40];
const char *name = NULL;
char c = *(p+1);
+ int p_len = p - p_start + 1;
forty = 0;
@@ -204,13 +205,10 @@ static void name_rev_line(char *p, struct name_ref_data *data)
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;
}
}