diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-16 14:32:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-16 14:32:44 -0700 |
commit | df64186f63fef8daef0fb4aedfa76aaf22b70b75 (patch) | |
tree | 5676bddfa26659f1070af362d2c864a97937c735 /wt-status.c | |
parent | 19d11d43fddd7535c93a616984c3815d5a444f99 (diff) | |
parent | 0eb8548f45cc51bff9b70f551f4c472af353a814 (diff) | |
download | git-df64186f63fef8daef0fb4aedfa76aaf22b70b75.tar.gz |
Merge branch 'mm/detach-at-HEAD-reflog' into maint
After "git checkout --detach", "git status" reported a fairly
useless "HEAD detached at HEAD", instead of saying at which exact
commit.
* mm/detach-at-HEAD-reflog:
status: don't say 'HEAD detached at HEAD'
t3203: test 'detached at' after checkout --detach
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c index c327fe8128..3e3b8c0989 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1319,6 +1319,12 @@ static int grab_1st_switch(unsigned char *osha1, unsigned char *nsha1, hashcpy(cb->nsha1, nsha1); for (end = target; *end && *end != '\n'; end++) ; + if (!memcmp(target, "HEAD", end - target)) { + /* HEAD is relative. Resolve it to the right reflog entry. */ + strbuf_addstr(&cb->buf, + find_unique_abbrev(nsha1, DEFAULT_ABBREV)); + return 1; + } strbuf_add(&cb->buf, target, end - target); return 1; } |