]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-fetch.c
Extend parse-options test suite
[git.git] / builtin-fetch.c
index 30aa42df6ebb1afb429442a51493ece9dccd2a0c..e81ee2d02b588c83f9ac355d20559271be73871d 100644 (file)
@@ -286,7 +286,7 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
 {
        FILE *fp;
        struct commit *commit;
-       int url_len, i, note_len, shown_url = 0;
+       int url_len, i, note_len, shown_url = 0, rc = 0;
        char note[1024];
        const char *what, *kind;
        struct ref *rm;
@@ -353,13 +353,11 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
                        note);
 
                if (ref)
-                       update_local_ref(ref, what, verbose, note);
-               else if (verbose)
+                       rc |= update_local_ref(ref, what, verbose, note);
+               else
                        sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
                                SUMMARY_WIDTH, *kind ? kind : "branch",
                                 REFCOL_WIDTH, *what ? what : "HEAD");
-               else
-                       *note = '\0';
                if (*note) {
                        if (!shown_url) {
                                fprintf(stderr, "From %.*s\n",
@@ -370,7 +368,7 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
                }
        }
        fclose(fp);
-       return 0;
+       return rc;
 }
 
 /*
@@ -504,10 +502,8 @@ static void find_non_local_tags(struct transport *transport,
                     will_fetch(head, ref->old_sha1))) {
                        path_list_insert(ref_name, &new_refs);
 
-                       rm = alloc_ref(strlen(ref_name) + 1);
-                       strcpy(rm->name, ref_name);
-                       rm->peer_ref = alloc_ref(strlen(ref_name) + 1);
-                       strcpy(rm->peer_ref->name, ref_name);
+                       rm = alloc_ref_from_str(ref_name);
+                       rm->peer_ref = alloc_ref_from_str(ref_name);
                        hashcpy(rm->old_sha1, ref_sha1);
 
                        **tail = rm;