diff options
author | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:47:34 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:47:34 -0800 |
commit | c388761c153bc3e874e75f69ff77430164c038c4 (patch) | |
tree | caacf48f2cdb1878ec7f4fe03c957c6d482738b9 /wt-status.c | |
parent | 4d229653ab5eda48f7b7c83cb2a876b48a41ffd4 (diff) | |
parent | bfbbb8f8cf8250718ffd028efe179557d29ae72d (diff) | |
download | git-c388761c153bc3e874e75f69ff77430164c038c4.tar.gz |
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
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/wt-status.c b/wt-status.c index a849951774..daba9a6105 100644 --- a/wt-status.c +++ b/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), "#"); |