]> git.ipfire.org Git - thirdparty/git.git/commit
fetch --negotiate-only: do not update submodules
authorGlen Choo <chooglen@google.com>
Wed, 19 Jan 2022 00:00:56 +0000 (16:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Jan 2022 00:22:58 +0000 (16:22 -0800)
commit386c076a863cfafd733b71564245be973e3d1bda
treeeedadc4a35b264d86507a62a0b02179beb369fa9
parent135a12bc1472290ca6b9a4c2f06c838a1495a612
fetch --negotiate-only: do not update submodules

`git fetch --negotiate-only` is an implementation detail of push
negotiation and, unlike most `git fetch` invocations, does not actually
update the main repository. Thus it should not update submodules even
if submodule recursion is enabled.

This is not just slow, it is wrong e.g. push negotiation with
"submodule.recurse=true" will cause submodules to be updated because it
invokes `git fetch --negotiate-only`.

Fix this by disabling submodule recursion if --negotiate-only was given.
Since this makes --negotiate-only and --recurse-submodules incompatible,
check for this invalid combination and die.

This does not use the "goto cleanup" introduced in the previous commit
because we want to recurse through submodules whenever a ref is fetched,
and this can happen without introducing new objects.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fetch-options.txt
builtin/fetch.c
t/t5516-fetch-push.sh
t/t5702-protocol-v2.sh