]> git.ipfire.org Git - thirdparty/git.git/blobdiff - remote.c
Resolve value supplied for no-colon push refspecs
[thirdparty/git.git] / remote.c
index 6b56473f5bb7d8ab2226ed83805f30c9e21ba773..8ee2487ed3af70685e6e30e46373cd3cbc6ff074 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -643,9 +643,17 @@ static int match_explicit(struct ref *src, struct ref *dst,
                errs = 1;
 
        if (!dst_value) {
+               unsigned char sha1[20];
+               int flag;
+
                if (!matched_src)
                        return errs;
-               dst_value = matched_src->name;
+               dst_value = resolve_ref(matched_src->name, sha1, 1, &flag);
+               if (!dst_value ||
+                   ((flag & REF_ISSYMREF) &&
+                    prefixcmp(dst_value, "refs/heads/")))
+                       die("%s cannot be resolved to branch.",
+                           matched_src->name);
        }
 
        switch (count_refspec_match(dst_value, dst, &matched_dst)) {