Fix incorrect ref namespace check

The reason why the trailing slash is needed is obvious. refs/stash and HEAD are not namespace, but complete refs. Do full string compare on them. 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 Jan 5, 2012 at 19:39 UTC 97ba642bcf918de028b2e77165c5210cf3f462e5
3 files changed +4 -4
builtin/fetch.c
+1 -1
@@ -574,7 +574,7 @@ static void find_non_local_tags(struct transport *transport,
574
575 for_each_ref(add_existing, &existing_refs);
576 for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
577 - if (prefixcmp(ref->name, "refs/tags"))
577 + if (prefixcmp(ref->name, "refs/tags/"))
578 continue;
579
580 /*
builtin/remote.c
+1 -1
@@ -535,7 +535,7 @@ static int add_branch_for_removal(const char *refname,
535 }
536
537 /* don't delete non-remote-tracking refs */
538 - if (prefixcmp(refname, "refs/remotes")) {
538 + if (prefixcmp(refname, "refs/remotes/")) {
539 /* advise user how to delete local branches */
540 if (!prefixcmp(refname, "refs/heads/"))
541 string_list_append(branches->skipped,
log-tree.c
+2 -2
@@ -119,9 +119,9 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
119 type = DECORATION_REF_REMOTE;
120 else if (!prefixcmp(refname, "refs/tags/"))
121 type = DECORATION_REF_TAG;
122 - else if (!prefixcmp(refname, "refs/stash"))
122 + else if (!strcmp(refname, "refs/stash"))
123 type = DECORATION_REF_STASH;
124 - else if (!prefixcmp(refname, "HEAD"))
124 + else if (!strcmp(refname, "HEAD"))
125 type = DECORATION_REF_HEAD;
126
127 if (!cb_data || *(int *)cb_data == DECORATE_SHORT_REFS)