aboutsummaryrefslogtreecommitdiff
path: root/builtin-branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-06 02:54:56 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-06 02:54:56 -0700
commit926ab840cdc867b54fa93b8e1ece2790315c2456 (patch)
tree4e96ebc8b63db395b81a49962e959e584873624c /builtin-branch.c
parentc0234b2ef6a8eaa27d9d93c4c96b36d9e82ebf9c (diff)
downloadgit-926ab840cdc867b54fa93b8e1ece2790315c2456.tar.gz
git-926ab840cdc867b54fa93b8e1ece2790315c2456.tar.xz
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>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r--builtin-branch.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin-branch.c b/builtin-branch.c
index e9423d1e4..ff71f3d8a 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -287,10 +287,8 @@ static void fill_tracking_info(char *stat, const char *branch_name)
int ours, theirs;
struct branch *branch = branch_get(branch_name);
- if (!stat_tracking_info(branch, &ours, &theirs) || (!ours && !theirs)) {
- stat[0] = '\0';
+ if (!stat_tracking_info(branch, &ours, &theirs) || (!ours && !theirs))
return;
- }
if (!ours)
sprintf(stat, "[behind %d] ", theirs);
else if (!theirs)
@@ -330,6 +328,7 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
char stat[128];
strbuf_init(&subject, 0);
+ stat[0] = '\0';
commit = lookup_commit(item->sha1);
if (commit && !parse_commit(commit)) {