Skip to content

Commit fbe85e7

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 108332c commit fbe85e7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

builtin/fsck.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,16 +678,17 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
678678
git_config(fsck_config, NULL);
679679

680680
fsck_head_link();
681-
if (!connectivity_only)
681+
if (!connectivity_only) {
682682
fsck_object_dir(get_object_directory());
683683

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+
}
691692
}
692693

693694
if (check_full) {

0 commit comments

Comments
 (0)