Skip to content

Commit

Permalink
fsck: don't fsck alternates for connectivity-only check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Sep 25, 2015
1 parent 108332c commit fbe85e7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions builtin/fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,16 +678,17 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
git_config(fsck_config, NULL);

fsck_head_link();
if (!connectivity_only)
if (!connectivity_only) {
fsck_object_dir(get_object_directory());

prepare_alt_odb();
for (alt = alt_odb_list; alt; alt = alt->next) {
char namebuf[PATH_MAX];
int namelen = alt->name - alt->base;
memcpy(namebuf, alt->base, namelen);
namebuf[namelen - 1] = 0;
fsck_object_dir(namebuf);
prepare_alt_odb();
for (alt = alt_odb_list; alt; alt = alt->next) {
char namebuf[PATH_MAX];
int namelen = alt->name - alt->base;
memcpy(namebuf, alt->base, namelen);
namebuf[namelen - 1] = 0;
fsck_object_dir(namebuf);
}
}

if (check_full) {
Expand Down

0 comments on commit fbe85e7

Please sign in to comment.