fetch: pass --no-write-fetch-head to subprocesses

It seems a user would expect this option would work regardless
of whether it's fetching from a single remote, many remotes,
or recursing into submodules.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Wong
2023-03-08 22:22:05 +00:00
committed by Junio C Hamano
parent 725f57037d
commit 15184ae9da
3 changed files with 22 additions and 0 deletions

View File

@ -167,6 +167,19 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
verify_fetch_result actual.err
'
test_expect_success "fetch --recurse-submodules honors --no-write-fetch-head" '
(
cd downstream &&
git submodule foreach --recursive \
sh -c "cd \"\$(git rev-parse --git-dir)\" && rm -f FETCH_HEAD" &&
git fetch --recurse-submodules --no-write-fetch-head &&
git submodule foreach --recursive \
sh -c "cd \"\$(git rev-parse --git-dir)\" && ! test -f FETCH_HEAD"
)
'
test_expect_success "submodule.recurse option triggers recursive fetch" '
add_submodule_commits &&
(