branch -r -v: do not spit out garbage
The codepath to emit relationship between the branch and what it tracks forgot to initialize a string buffer stat[] to empty when showing a tracking branch. This moves the emptying so that the buffer starts as empty and stays so when no information is added to fix this issue. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 6, 2008 at 02:54 UTC
926ab840cdc867b54fa93b8e1ece2790315c2456
1 file changed
+2
-3
builtin-branch.c
+2
-3
@@ -287,10 +287,8 @@ static void fill_tracking_info(char *stat, const char *branch_name)
287
int ours, theirs;
288
struct branch *branch = branch_get(branch_name);
289
290
- if (!stat_tracking_info(branch, &ours, &theirs) || (!ours && !theirs)) {
291
- stat[0] = '\0';
290
+ if (!stat_tracking_info(branch, &ours, &theirs) || (!ours && !theirs))
291
return;
293
- }
292
if (!ours)
293
sprintf(stat, "[behind %d] ", theirs);
294
else if (!theirs)
@@ -330,6 +328,7 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
328
char stat[128];
329
330
strbuf_init(&subject, 0);
331
+ stat[0] = '\0';
332
333
commit = lookup_commit(item->sha1);
334
if (commit && !parse_commit(commit)) {