Skip to content

Commit

Permalink
wt-status: don't skip a magical number of characters blindly
Browse files Browse the repository at this point in the history
Use the variable branch_name, which already has "refs/heads/" removed,
instead of blindly advancing in the ->branch string by 11 bytes.  This
is safer and less magical.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Nov 1, 2015
1 parent baf0a3e commit 8d8325f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
if (starts_with(branch_name, "refs/heads/"))
branch_name += 11;

branch = branch_get(s->branch + 11);
branch = branch_get(branch_name);

color_fprintf(s->fp, branch_color_local, "%s", branch_name);

Expand Down

0 comments on commit 8d8325f

Please sign in to comment.