]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5514-fetch-multiple.sh
fetch: only run 'gc' once when fetching multiple remotes
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 19 Jun 2019 09:46:30 +0000 (16:46 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jun 2019 03:56:44 +0000 (20:56 -0700)
commitc3d6b70338d0ac93f66142873f1606277dbe589f
tree2ea41e30c1bc6f2ac70c89aebf088e3bb256ad3f
parentb697d92f56511e804b8ba20ccbe7bdc85dc66810
fetch: only run 'gc' once when fetching multiple remotes

In multiple remotes mode, git-fetch is launched for n-1 remotes and the
last remote is handled by the current process. Each of these processes
will in turn run 'gc' at the end.

This is not really a problem because even if multiple 'gc --auto' is run
at the same time we still handle it correctly. It does show multiple
"auto packing in the background" messages though. And we may waste some
resources when gc actually runs because we still do some stuff before
checking the lock and moving it to background.

So let's try to avoid that. We should only need one 'gc' run after all
objects and references are added anyway. Add a new option --no-auto-gc
that will be used by those n-1 processes. 'gc --auto' will always run on
the main fetch process (*).

(*) even if we fetch remotes in parallel at some point in future, this
    should still be fine because we should "join" all those processes
    before this step.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fetch-options.txt
builtin/fetch.c
t/t5514-fetch-multiple.sh