Merge branch 'jc/maint-fetch-tighten-refname-check'
authorJunio C Hamano <gitster@pobox.com>
Thu, 15 Nov 2012 18:22:54 +0000 (10:22 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Nov 2012 18:22:54 +0000 (10:22 -0800)
For a fetch refspec (or the result of applying wildcard on one), we
always want the RHS to map to something inside "refs/" hierarchy.

This was split out from discarded jc/maint-push-refs-all topic.

* jc/maint-fetch-tighten-refname-check:
  get_fetch_map(): tighten checks on dest refs

remote.c

index 04fd9ea..5882d11 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1458,8 +1458,8 @@ int get_fetch_map(const struct ref *remote_refs,
 
        for (rmp = &ref_map; *rmp; ) {
                if ((*rmp)->peer_ref) {
-                       if (check_refname_format((*rmp)->peer_ref->name + 5,
-                               REFNAME_ALLOW_ONELEVEL)) {
+                       if (prefixcmp((*rmp)->peer_ref->name, "refs/") ||
+                           check_refname_format((*rmp)->peer_ref->name, 0)) {
                                struct ref *ignore = *rmp;
                                error("* Ignoring funny ref '%s' locally",
                                      (*rmp)->peer_ref->name);