]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-fetch.c
Merge branch 'jk/renamelimit' (early part)
[git.git] / builtin-fetch.c
index e4486e428625f781877749b86388f1e1795d0e03..f6584ecea165704208059b632bb1a1ac2b6a6d1f 100644 (file)
@@ -508,10 +508,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;
@@ -575,8 +573,6 @@ static int do_fetch(struct transport *transport,
                free_refs(ref_map);
        }
 
-       transport_disconnect(transport);
-
        return 0;
 }
 
@@ -597,6 +593,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        int i;
        static const char **refs = NULL;
        int ref_nr = 0;
+       int exit_code;
 
        /* Record the command line for the reflog */
        strbuf_addstr(&default_rla, "fetch");
@@ -650,6 +647,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 
        signal(SIGINT, unlock_pack_on_signal);
        atexit(unlock_pack);
-       return do_fetch(transport,
+       exit_code = do_fetch(transport,
                        parse_fetch_refspec(ref_nr, refs), ref_nr);
+       transport_disconnect(transport);
+       transport = NULL;
+       return exit_code;
 }