diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 7cb6f0e0942e4c..f68fc30c9b9ff7 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4589,6 +4589,12 @@ int cmd_pack_objects(int argc, if (use_full_name_hash < 0) use_full_name_hash = git_env_bool("GIT_TEST_FULL_NAME_HASH", 0); + if (shallow && use_full_name_hash > 0 && + !git_env_bool("GIT_TEST_USE_FULL_NAME_HASH_WITH_SHALLOW", 0)) { + use_full_name_hash = 0; + warning("the --full-name-hash option is disabled with the --shallow option"); + } + if (write_bitmap_index && use_full_name_hash > 0) { warning(_("currently, the --full-name-hash option is incompatible with --write-bitmap-index")); use_full_name_hash = 0; diff --git a/t/perf/p5313-pack-objects.sh b/t/perf/p5313-pack-objects.sh index dfa29695315789..a7f4e0bf8d86e6 100755 --- a/t/perf/p5313-pack-objects.sh +++ b/t/perf/p5313-pack-objects.sh @@ -66,6 +66,7 @@ test_size 'shallow pack size' ' ' test_perf 'shallow pack with --full-name-hash' ' + GIT_TEST_USE_FULL_NAME_HASH_WITH_SHALLOW=1 \ git pack-objects --stdout --revs --sparse --shallow --full-name-hash out '