Code

builtin-fetch.c (store_updated_refs): Honor update_local_ref() return value
[git.git] / builtin-send-pack.c
index b0cfae83fc4dcdd8f58e29b87fd8aa4b6af0f6c0..d76260c09eef064d8a2862b5d6f0e826d968d643 100644 (file)
@@ -264,9 +264,7 @@ static void print_ref_status(char flag, const char *summary, struct ref *to, str
 
 static const char *status_abbrev(unsigned char sha1[20])
 {
-       const char *abbrev;
-       abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
-       return abbrev ? abbrev : sha1_to_hex(sha1);
+       return find_unique_abbrev(sha1, DEFAULT_ABBREV);
 }
 
 static void print_ok_ref_status(struct ref *ref)
@@ -539,9 +537,17 @@ static void verify_remote_names(int nr_heads, const char **heads)
        int i;
 
        for (i = 0; i < nr_heads; i++) {
-               const char *remote = strchr(heads[i], ':');
+               const char *local = heads[i];
+               const char *remote = strrchr(heads[i], ':');
 
-               remote = remote ? (remote + 1) : heads[i];
+               if (*local == '+')
+                       local++;
+
+               /* A matching refspec is okay.  */
+               if (remote == local && remote[1] == '\0')
+                       continue;
+
+               remote = remote ? (remote + 1) : local;
                switch (check_ref_format(remote)) {
                case 0: /* ok */
                case CHECK_REF_FORMAT_ONELEVEL: