Skip to content

Commit

Permalink
Merge branch 'ew/fetch-no-write-fetch-head-fix'
Browse files Browse the repository at this point in the history
* ew/fetch-no-write-fetch-head-fix:
  fetch: pass --no-write-fetch-head to subprocesses
  • Loading branch information
gitster committed Mar 19, 2023
2 parents 9de14c7 + 15184ae commit 947604d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/fetch.c
Expand Up @@ -1883,6 +1883,8 @@ static void add_options_to_argv(struct strvec *argv)
strvec_push(argv, "--ipv4");
else if (family == TRANSPORT_FAMILY_IPV6)
strvec_push(argv, "--ipv6");
if (!write_fetch_head)
strvec_push(argv, "--no-write-fetch-head");
}

/* Fetch multiple remotes in parallel */
Expand Down
7 changes: 7 additions & 0 deletions t/t5514-fetch-multiple.sh
Expand Up @@ -58,6 +58,13 @@ test_expect_success 'git fetch --all' '
test_cmp expect output)
'

test_expect_success 'git fetch --all --no-write-fetch-head' '
(cd test &&
rm -f .git/FETCH_HEAD &&
git fetch --all --no-write-fetch-head &&
test_path_is_missing .git/FETCH_HEAD)
'

test_expect_success 'git fetch --all should continue if a remote has errors' '
(git clone one test2 &&
cd test2 &&
Expand Down
13 changes: 13 additions & 0 deletions t/t5526-fetch-submodules.sh
Expand Up @@ -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 &&
(
Expand Down

0 comments on commit 947604d

Please sign in to comment.