diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index b49f5fe797a28d..224c39caa40f11 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4812,10 +4812,6 @@ int cmd_pack_objects(int argc, warning(_("cannot use delta islands with --path-walk")); path_walk = 0; } - if (path_walk && shallow) { - warning(_("cannot use --shallow with --path-walk")); - path_walk = 0; - } if (path_walk) { strvec_push(&rp, "--boundary"); /* diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 605f17240c191a..f5d32bf9f5eff0 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -463,6 +463,18 @@ test_expect_success 'fetch in shallow repo unreachable shallow objects' ' git fsck --no-dangling ) ' + +# At the moment, the --path-walk option may provide more objects +# when combined with --shallow than the --no-path-walk option. +if test_bool_env GIT_TEST_PACK_PATH_WALK true +then + EXPECTED_SHALLOW_OBJECTS=3 && + export EXPECTED_SHALLOW_OBJECTS +else + EXPECTED_SHALLOW_OBJECTS=1 && + export EXPECTED_SHALLOW_OBJECTS +fi + test_expect_success 'fetch creating new shallow root' ' ( git clone "file://$(pwd)/." shallow10 && @@ -471,7 +483,7 @@ test_expect_success 'fetch creating new shallow root' ' git fetch --depth=1 --progress 2>actual && # This should fetch only the empty commit, no tree or # blob objects - test_grep "remote: Total 1" actual + test_grep "remote: Total $EXPECTED_SHALLOW_OBJECTS" actual ) '