]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-fetch.c
Remove unnecessary delaying of free_refs(ref_map) in builtin-fetch
[git.git] / builtin-fetch.c
index 320e235682340f07cb28b0a4de0c39b6bd9da383..1348a0e952fd2ff7ad9b05995c030708e6045723 100644 (file)
@@ -452,8 +452,7 @@ static int add_existing(const char *refname, const unsigned char *sha1,
        return 0;
 }
 
-static struct ref *find_non_local_tags(struct transport *transport,
-                                      struct ref *fetch_map)
+static struct ref *find_non_local_tags(struct transport *transport)
 {
        static struct path_list existing_refs = { NULL, 0, 0, 0 };
        struct path_list new_refs = { NULL, 0, 0, 1 };
@@ -510,7 +509,7 @@ static struct ref *find_non_local_tags(struct transport *transport,
 static int do_fetch(struct transport *transport,
                    struct refspec *refs, int ref_count)
 {
-       struct ref *ref_map, *fetch_map;
+       struct ref *ref_map;
        struct ref *rm;
        int autotags = (transport->remote->fetch_tags == 1);
        if (transport->remote->fetch_tags == 2 && tags != TAGS_UNSET)
@@ -541,13 +540,12 @@ static int do_fetch(struct transport *transport,
                free_refs(ref_map);
                return 1;
        }
-
-       fetch_map = ref_map;
+       free_refs(ref_map);
 
        /* if neither --no-tags nor --tags was specified, do automated tag
         * following ... */
        if (tags == TAGS_DEFAULT && autotags) {
-               ref_map = find_non_local_tags(transport, fetch_map);
+               ref_map = find_non_local_tags(transport);
                if (ref_map) {
                        transport_set_option(transport, TRANS_OPT_DEPTH, "0");
                        fetch_refs(transport, ref_map);
@@ -555,7 +553,7 @@ static int do_fetch(struct transport *transport,
                free_refs(ref_map);
        }
 
-       free_refs(fetch_map);
+       transport_disconnect(transport);
 
        return 0;
 }