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 <peff@peff.net>
Jeff King committed
May 2, 2018 at 17:20 UTC
1995b5e03e1cc97116be58cdc0502d4a23547856
2 files changed
+7
builtin/fsck.c
+3
@@ -748,6 +748,9 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
748
}
749
stop_progress(&progress);
750
}
751
+
752
+ if (fsck_finish(&fsck_obj_options))
753
+ errors_found |= ERROR_OBJECT;
754
}
755
756
for (i = 0; i < argc; i++) {
t/t7415-submodule-names.sh
+4
@@ -73,4 +73,8 @@ test_expect_success 'clone evil superproject' '
73
! grep "RUNNING POST CHECKOUT" output
74
'
75
76
+test_expect_success 'fsck detects evil superproject' '
77
+ test_must_fail git fsck
78
+'
79
+
80
test_done