fsck: call fsck_finish() after fscking objects
authorJeff King <peff@peff.net>
Wed, 2 May 2018 21:20:35 +0000 (17:20 -0400)
committerJeff King <peff@peff.net>
Tue, 22 May 2018 03:55:12 +0000 (23:55 -0400)
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 <peff@peff.net>
builtin/fsck.c
t/t7415-submodule-names.sh
index f91d5f360dd016505562a9d4380369aa8faee5f5..028aba52ebaab764d1f4f91c926e54d66dcaa20f 100644 (file)
@@ -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++) {
index 75fa071c6d042aad43d3255935c1d99324073a31..c8ce2f4717f3305c4b82914deab894d849e25836 100755 (executable)
@@ -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