decoration: do not mis-decorate refs with same prefix
We definitely do not want to decorate refs/headsandtails the same as refs/heads/*, for example. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 18, 2011 at 19:29 UTC
594ffe80e7827b20335c5c6dde2cf57c9919db68
1 file changed
+3
-3
log-tree.c
+3
-3
@@ -95,11 +95,11 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
95
if (!obj)
96
return 0;
97
98
- if (!prefixcmp(refname, "refs/heads"))
98
+ if (!prefixcmp(refname, "refs/heads/"))
99
type = DECORATION_REF_LOCAL;
100
- else if (!prefixcmp(refname, "refs/remotes"))
100
+ else if (!prefixcmp(refname, "refs/remotes/"))
101
type = DECORATION_REF_REMOTE;
102
- else if (!prefixcmp(refname, "refs/tags"))
102
+ else if (!prefixcmp(refname, "refs/tags/"))
103
type = DECORATION_REF_TAG;
104
else if (!prefixcmp(refname, "refs/stash"))
105
type = DECORATION_REF_STASH;