mirror of
https://github.com/git/git.git
synced 2026-04-05 06:20:09 +02:00
git: extend --no-lazy-fetch to work across subprocesses
Modeling after how the `--no-replace-objects` option is made usable across subprocess spawning (e.g., cURL based remote helpers are spawned as a separate process while running "git fetch"), allow the `--no-lazy-fetch` option to be passed across process boundaries. Do not model how the value of GIT_NO_REPLACE_OBJECTS environment variable is ignored, though. Just use the usual git_env_bool() to allow "export GIT_NO_LAZY_FETCH=0" and "unset GIT_NO_LAZY_FETCH" to be equivalents. Also do not model how the request is not propagated to subprocesses we spawn (e.g. "git clone --local" that spawns a new process to work in the origin repository, while the original one working in the newly created one) by the "--no-replace-objects" option, as this "do not lazily fetch from the promisor" is more about a per-request debugging aid, not "this repository's promisor should not be relied upon" property specific to a repository. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -665,6 +665,21 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
|
||||
git -C partial.git rev-list --objects --missing=print HEAD >out &&
|
||||
grep "[?]$FILE_HASH" out &&
|
||||
|
||||
# The no-lazy-fetch mechanism prevents Git from fetching
|
||||
test_must_fail env GIT_NO_LAZY_FETCH=1 \
|
||||
git -C partial.git cat-file -e "$FILE_HASH" &&
|
||||
|
||||
# The same with command line option to "git"
|
||||
test_must_fail git --no-lazy-fetch -C partial.git cat-file -e "$FILE_HASH" &&
|
||||
|
||||
# The same, forcing a subprocess via an alias
|
||||
test_must_fail git --no-lazy-fetch -C partial.git \
|
||||
-c alias.foo="!git cat-file" foo -e "$FILE_HASH" &&
|
||||
|
||||
# Sanity check that the file is still missing
|
||||
git -C partial.git rev-list --objects --missing=print HEAD >out &&
|
||||
grep "[?]$FILE_HASH" out &&
|
||||
|
||||
git -C full cat-file -s "$FILE_HASH" >expect &&
|
||||
test-tool partial-clone object-info partial.git "$FILE_HASH" >actual &&
|
||||
test_cmp expect actual &&
|
||||
|
||||
Reference in New Issue
Block a user