From: Jeff King Date: Wed, 2 May 2018 21:20:35 +0000 (-0400) Subject: fsck: call fsck_finish() after fscking objects X-Git-Tag: v2.17.1~1^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1995b5e03e1cc97116be58cdc0502d4a23547856?hp=--cc fsck: call fsck_finish() after fscking objects Now that the internal fsck code is capable of checking .gitmodules files, we just need to teach its callers to use the "finish" function to check any queued objects. With this, we can now catch the malicious case in t7415 with git-fsck. Signed-off-by: Jeff King --- 1995b5e03e1cc97116be58cdc0502d4a23547856 diff --git a/builtin/fsck.c b/builtin/fsck.c index f91d5f360d..028aba52eb 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -748,6 +748,9 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) } stop_progress(&progress); } + + if (fsck_finish(&fsck_obj_options)) + errors_found |= ERROR_OBJECT; } for (i = 0; i < argc; i++) { diff --git a/t/t7415-submodule-names.sh b/t/t7415-submodule-names.sh index 75fa071c6d..c8ce2f4717 100755 --- a/t/t7415-submodule-names.sh +++ b/t/t7415-submodule-names.sh @@ -73,4 +73,8 @@ test_expect_success 'clone evil superproject' ' ! grep "RUNNING POST CHECKOUT" output ' +test_expect_success 'fsck detects evil superproject' ' + test_must_fail git fsck +' + test_done