Merge branch 'nd/fetch-multi-gc-once'
authorJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)
"git fetch" that grabs from a group of remotes learned to run the
auto-gc only once at the very end.

* nd/fetch-multi-gc-once:
fetch: only run 'gc' once when fetching multiple remotes

1  2 
builtin/fetch.c
diff --cc builtin/fetch.c
index c9b92b1e52448bb1537a229b3ed7d1587db28ecf,6a3c5078974d553447c6468032408f99e76cc57d..667f2cec7bdcc1bd5bf6f0f99d0dc39ff4071b98
@@@ -1680,13 -1675,15 +1683,15 @@@ int cmd_fetch(int argc, const char **ar
  
        string_list_clear(&list, 0);
  
 -      close_all_packs(the_repository->objects);
 +      close_object_store(the_repository->objects);
  
-       argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
-       if (verbosity < 0)
-               argv_array_push(&argv_gc_auto, "--quiet");
-       run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);
-       argv_array_clear(&argv_gc_auto);
+       if (enable_auto_gc) {
+               argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
+               if (verbosity < 0)
+                       argv_array_push(&argv_gc_auto, "--quiet");
+               run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);
+               argv_array_clear(&argv_gc_auto);
+       }
  
        return result;
  }