diff --git a/builtin/fsck.c b/builtin/fsck.c index 5132ff0f15..3f6056535f 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -1047,7 +1047,8 @@ int cmd_fsck(int argc, mark_object_for_connectivity, repo, 0); } else { for (source = repo->objects->sources; source; source = source->next) - fsck_source(repo, source); + if (check_full || source->local) + fsck_source(repo, source); if (check_full) { struct packed_git *p; diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 77cd96de78..1b4074304c 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -844,6 +844,11 @@ test_expect_success 'alternate objects are correctly blamed' ' echo "../../alt.git/objects" >.git/objects/info/alternates && mkdir alt.git/objects/$(dirname $path) && >alt.git/objects/$(dirname $path)/$(basename $path) && + + # Without "--full", only the local object source is checked. + git fsck --no-full >out 2>&1 && + test_must_be_empty out && + test_must_fail git fsck >out 2>&1 && test_grep alt.git out '