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>
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)
char stat[128];
strbuf_init(&subject, 0);
+ stat[0] = '\0';
commit = lookup_commit(item->sha1);
if (commit && !parse_commit(commit)) {