fsck: don't fsck alternates for connectivity-only check

Commit 02976bf (fsck: introduce `git fsck --connectivity-only`, 2015-06-22) recently gave fsck an option to perform only a subset of the checks, by skipping the fsck_object_dir() call. However, it does so only for the local object directory, and we still do expensive checks on any alternate repos. We should skip them in this case, too. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 24, 2015 at 17:05 UTC fbe85e73ce425b25c15f0b1f3900a9bf895a9793
1 file changed +9 -8
builtin/fsck.c
+9 -8
@@ -678,16 +678,17 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
678 git_config(fsck_config, NULL);
679
680 fsck_head_link();
681 - if (!connectivity_only)
681 + if (!connectivity_only) {
682 fsck_object_dir(get_object_directory());
683
684 - prepare_alt_odb();
685 - for (alt = alt_odb_list; alt; alt = alt->next) {
686 - char namebuf[PATH_MAX];
687 - int namelen = alt->name - alt->base;
688 - memcpy(namebuf, alt->base, namelen);
689 - namebuf[namelen - 1] = 0;
690 - fsck_object_dir(namebuf);
684 + prepare_alt_odb();
685 + for (alt = alt_odb_list; alt; alt = alt->next) {
686 + char namebuf[PATH_MAX];
687 + int namelen = alt->name - alt->base;
688 + memcpy(namebuf, alt->base, namelen);
689 + namebuf[namelen - 1] = 0;
690 + fsck_object_dir(namebuf);
691 + }
692 }
693
694 if (check_full) {