Code

decoration: do not mis-decorate refs with same prefix
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 18 Aug 2011 12:29:34 +0000 (19:29 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Aug 2011 17:58:19 +0000 (10:58 -0700)
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>
log-tree.c

index e9457019d5ac7aff1e185e195f37b851732f6210..344f7347cc4967fe3e51c5c7b99d5809afe97ec1 100644 (file)
@@ -95,11 +95,11 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
        if (!obj)
                return 0;
 
-       if (!prefixcmp(refname, "refs/heads"))
+       if (!prefixcmp(refname, "refs/heads/"))
                type = DECORATION_REF_LOCAL;
-       else if (!prefixcmp(refname, "refs/remotes"))
+       else if (!prefixcmp(refname, "refs/remotes/"))
                type = DECORATION_REF_REMOTE;
-       else if (!prefixcmp(refname, "refs/tags"))
+       else if (!prefixcmp(refname, "refs/tags/"))
                type = DECORATION_REF_TAG;
        else if (!prefixcmp(refname, "refs/stash"))
                type = DECORATION_REF_STASH;