]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/ls-remote.c
Merge branch 'en/ort-perf-batch-9'
[thirdparty/git.git] / builtin / ls-remote.c
index ef604752a044a48609a10ee90a8ca487c0acfb2d..1794548c71179afb68c74a231749be5f5fdae3ee 100644 (file)
@@ -88,7 +88,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 
        if (argc > 1) {
                int i;
-               pattern = xcalloc(argc, sizeof(const char *));
+               CALLOC_ARRAY(pattern, argc);
                for (i = 1; i < argc; i++) {
                        pattern[i - 1] = xstrfmt("*/%s", argv[i]);
                }
@@ -124,8 +124,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
                int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
                repo_set_hash_algo(the_repository, hash_algo);
        }
-       if (transport_disconnect(transport))
-               return 1;
 
        if (!dest && !quiet)
                fprintf(stderr, "From %s\n", *remote->url);
@@ -151,5 +149,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
        }
 
        ref_array_clear(&ref_array);
+       if (transport_disconnect(transport))
+               return 1;
        return status;
 }