From: Junio C Hamano Date: Thu, 5 Nov 2015 20:18:15 +0000 (-0800) Subject: Merge branch 'rs/wt-status-detached-branch-fix' into maint X-Git-Tag: v2.6.3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db43891ce60d0f713a41cfc46097262c73aa99d7;p=thirdparty%2Fgit.git Merge branch 'rs/wt-status-detached-branch-fix' into maint "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 --- db43891ce60d0f713a41cfc46097262c73aa99d7 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;