summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a2f5be5)
raw | patch | inline | side by side (parent: a2f5be5)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 26 May 2008 22:09:51 +0000 (15:09 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 26 May 2008 22:09:56 +0000 (15:09 -0700) |
The code assumed that there always is the current branch, but the result
from resolve_ref() on detached HEAD does not even start with "refs/heads/".
Originally noticed and fixed by Stephan Beyer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
from resolve_ref() on detached HEAD does not even start with "refs/heads/".
Originally noticed and fixed by Stephan Beyer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-show-branch.c | patch | blob | history |
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 019abd3527e7c573c69900a58313749e2ef2280a..a383323184bdcfb5258ed8d375ac22990f95877c 100644 (file)
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
has_head++;
}
if (!has_head) {
- int pfxlen = strlen("refs/heads/");
- append_one_rev(head + pfxlen);
+ int offset = !prefixcmp(head, "refs/heads/") ? 11 : 0;
+ append_one_rev(head + offset);
}
}