mirror of
https://github.com/git/git.git
synced 2026-03-05 06:57:37 +01:00
Merge branch 'pt/promisor-lazy-fetch-no-recurse' into jch
* pt/promisor-lazy-fetch-no-recurse: promisor-remote: prevent lazy-fetch recursion in child fetch
This commit is contained in:
@@ -42,6 +42,13 @@ static int fetch_objects(struct repository *repo,
|
||||
child.in = -1;
|
||||
if (repo != the_repository)
|
||||
prepare_other_repo_env(&child.env, repo->gitdir);
|
||||
/*
|
||||
* Prevent the child's index-pack from recursing back into
|
||||
* fetch_objects() when resolving REF_DELTA bases it does not
|
||||
* have. With noop negotiation the server should never need
|
||||
* to send such deltas, so a depth-2 fetch would not help.
|
||||
*/
|
||||
strvec_pushf(&child.env, "%s=1", NO_LAZY_FETCH_ENVIRONMENT);
|
||||
strvec_pushl(&child.args, "-c", "fetch.negotiationAlgorithm=noop",
|
||||
"fetch", remote_name, "--no-tags",
|
||||
"--no-write-fetch-head", "--recurse-submodules=no",
|
||||
|
||||
@@ -78,4 +78,30 @@ test_expect_success 'promisor lazy-fetching can be re-enabled' '
|
||||
test_path_is_file script-executed
|
||||
'
|
||||
|
||||
test_expect_success 'lazy-fetch child has GIT_NO_LAZY_FETCH=1' '
|
||||
test_create_repo nolazy-server &&
|
||||
test_commit -C nolazy-server foo &&
|
||||
git -C nolazy-server repack -a -d --write-bitmap-index &&
|
||||
|
||||
git clone "file://$(pwd)/nolazy-server" nolazy-client &&
|
||||
HASH=$(git -C nolazy-client rev-parse foo) &&
|
||||
rm -rf nolazy-client/.git/objects/* &&
|
||||
|
||||
git -C nolazy-client config core.repositoryformatversion 1 &&
|
||||
git -C nolazy-client config extensions.partialclone "origin" &&
|
||||
|
||||
# Install a reference-transaction hook to record the env var
|
||||
# as seen by processes inside the child fetch.
|
||||
test_hook -C nolazy-client reference-transaction <<-\EOF &&
|
||||
echo "$GIT_NO_LAZY_FETCH" >>../env-in-child
|
||||
EOF
|
||||
|
||||
rm -f env-in-child &&
|
||||
git -C nolazy-client cat-file -p "$HASH" &&
|
||||
|
||||
# The hook runs inside the child fetch, which should have
|
||||
# GIT_NO_LAZY_FETCH=1 in its environment.
|
||||
grep "^1$" env-in-child
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user