Skip to content

Commit 1995b5e

Browse files
committed
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 <[email protected]>
1 parent ed8b10f commit 1995b5e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

builtin/fsck.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,9 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
748748
}
749749
stop_progress(&progress);
750750
}
751+
752+
if (fsck_finish(&fsck_obj_options))
753+
errors_found |= ERROR_OBJECT;
751754
}
752755

753756
for (i = 0; i < argc; i++) {

t/t7415-submodule-names.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ test_expect_success 'clone evil superproject' '
7373
! grep "RUNNING POST CHECKOUT" output
7474
'
7575

76+
test_expect_success 'fsck detects evil superproject' '
77+
test_must_fail git fsck
78+
'
79+
7680
test_done

0 commit comments

Comments
 (0)