Merge branch 'jc/detached-head'
* jc/detached-head: git-checkout: handle local changes sanely when detaching HEAD git-checkout: safety check for detached HEAD checks existing refs git-checkout: fix branch name output from the command git-checkout: safety when coming back from the detached HEAD state. git-checkout: rewording comments regarding detached HEAD. git-checkout: do not warn detaching HEAD when it is already detached. Detached HEAD (experimental) git-branch: show detached HEAD git-status: show detached HEAD
This commit is contained in:
13
wt-status.c
13
wt-status.c
@ -302,9 +302,18 @@ void wt_status_print(struct wt_status *s)
|
||||
unsigned char sha1[20];
|
||||
s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
|
||||
|
||||
if (s->branch)
|
||||
if (s->branch) {
|
||||
const char *on_what = "On branch ";
|
||||
const char *branch_name = s->branch;
|
||||
if (!strncmp(branch_name, "refs/heads/", 11))
|
||||
branch_name += 11;
|
||||
else if (!strcmp(branch_name, "HEAD")) {
|
||||
branch_name = "";
|
||||
on_what = "Not currently on any branch.";
|
||||
}
|
||||
color_printf_ln(color(WT_STATUS_HEADER),
|
||||
"# On branch %s", s->branch);
|
||||
"# %s%s", on_what, branch_name);
|
||||
}
|
||||
|
||||
if (s->is_initial) {
|
||||
color_printf_ln(color(WT_STATUS_HEADER), "#");
|
||||
|
||||
Reference in New Issue
Block a user