From 25bccb4b79dce1d5c259228ef3c91eadcd13d8ac Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Fri, 31 Mar 2023 15:59:04 +0000 Subject: fetch: download bundles once, even with --all When fetch.bundleURI is set, 'git fetch' downloads bundles from the given bundle URI before fetching from the specified remote. However, when using non-file remotes, 'git fetch --all' will launch 'git fetch' subprocesses which then read fetch.bundleURI and fetch the bundle list again. We do not expect the bundle list to have new information during these multiple runs, so avoid these extra calls by un-setting fetch.bundleURI in the subprocess arguments. Be careful to skip fetching bundles for the empty bundle string. Fetching bundles from the empty list presents some interesting test failures. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- builtin/fetch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/fetch.c b/builtin/fetch.c index 7221e57f35..8d8b2e0c26 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1955,7 +1955,12 @@ static int fetch_multiple(struct string_list *list, int max_children) return errcode; } - strvec_pushl(&argv, "fetch", "--append", "--no-auto-gc", + /* + * Cancel out the fetch.bundleURI config when running subprocesses, + * to avoid fetching from the same bundle list multiple times. + */ + strvec_pushl(&argv, "-c", "fetch.bundleURI=", + "fetch", "--append", "--no-auto-gc", "--no-write-commit-graph", NULL); add_options_to_argv(&argv); -- cgit v1.3-5-g9baa