From: Junio C Hamano Date: Tue, 3 Nov 2015 23:13:08 +0000 (-0800) Subject: Merge branch 'rs/wt-status-detached-branch-fix' X-Git-Tag: v2.7.0-rc0~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a59d1d8035a1a6d878274e97818c56bb691ac5c0;p=thirdparty%2Fgit.git Merge branch 'rs/wt-status-detached-branch-fix' "git status --branch --short" accessed beyond the constant string "HEAD", which has been corrected. * rs/wt-status-detached-branch-fix: wt-status: use skip_prefix() to get rid of magic string length constants wt-status: don't skip a magical number of characters blindly wt-status: avoid building bogus branch name with detached HEAD wt-status: exit early using goto in wt_shortstatus_print_tracking() t7060: add test for status --branch on a detached HEAD --- a59d1d8035a1a6d878274e97818c56bb691ac5c0 diff --cc wt-status.c index 3e3b8c0989,62383a27f9..435fc2806e --- a/wt-status.c +++ b/wt-status.c @@@ -1442,15 -1318,10 +1438,13 @@@ void wt_status_print(struct wt_status * if (s->branch) { const char *on_what = _("On branch "); const char *branch_name = s->branch; - if (starts_with(branch_name, "refs/heads/")) - branch_name += 11; - else if (!strcmp(branch_name, "HEAD")) { + if (!strcmp(branch_name, "HEAD")) { branch_status_color = color(WT_STATUS_NOBRANCH, s); if (state.rebase_in_progress || state.rebase_interactive_in_progress) { - on_what = _("rebase in progress; onto "); + if (state.rebase_interactive_in_progress) + on_what = _("interactive rebase in progress; onto "); + else + on_what = _("rebase in progress; onto "); branch_name = state.onto; } else if (state.detached_from) { branch_name = state.detached_from;