diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 648b952ab0..c8f1406d23 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -572,8 +572,11 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix) unpack_all(); the_hash_algo->update_fn(&ctx, buffer, offset); the_hash_algo->final_fn(oid.hash, &ctx); - if (strict) + if (strict) { write_rest(); + if (fsck_finish(&fsck_options)) + die(_("fsck error in pack objects")); + } if (hashcmp(fill(the_hash_algo->rawsz), oid.hash)) die("final sha1 did not match"); use(the_hash_algo->rawsz); diff --git a/t/t7415-submodule-names.sh b/t/t7415-submodule-names.sh index c8ce2f4717..7fdf5d68bd 100755 --- a/t/t7415-submodule-names.sh +++ b/t/t7415-submodule-names.sh @@ -77,4 +77,11 @@ test_expect_success 'fsck detects evil superproject' ' test_must_fail git fsck ' +test_expect_success 'transfer.fsckObjects detects evil superproject (unpack)' ' + rm -rf dst.git && + git init --bare dst.git && + git -C dst.git config transfer.fsckObjects true && + test_must_fail git push dst.git HEAD +' + test_done