summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-09-13 18:02:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-17 20:49:41 (GMT)
commit66ec0390e75406aa9f9295577052b9ec06d3a169 (patch)
tree10ac7957629a11cb4dff8d14db35f74c78e21fc0 /builtin/fsck.c
parent144d70333e826ea2480d60eb2298013eeef0cabf (diff)
downloadgit-66ec0390e75406aa9f9295577052b9ec06d3a169.zip
git-66ec0390e75406aa9f9295577052b9ec06d3a169.tar.gz
git-66ec0390e75406aa9f9295577052b9ec06d3a169.tar.bz2
fsck: verify multi-pack-index
When core.multiPackIndex is true, we may have a multi-pack-index in our object directory. Add calls to 'git multi-pack-index verify' at the end of 'git fsck' if so. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 63c8578..06eb421 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -848,5 +848,23 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
}
}
+ if (!git_config_get_bool("core.multipackindex", &i) && i) {
+ struct child_process midx_verify = CHILD_PROCESS_INIT;
+ const char *midx_argv[] = { "multi-pack-index", "verify", NULL, NULL, NULL };
+
+ midx_verify.argv = midx_argv;
+ midx_verify.git_cmd = 1;
+ if (run_command(&midx_verify))
+ errors_found |= ERROR_COMMIT_GRAPH;
+
+ prepare_alt_odb(the_repository);
+ for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next) {
+ midx_argv[2] = "--object-dir";
+ midx_argv[3] = alt->path;
+ if (run_command(&midx_verify))
+ errors_found |= ERROR_COMMIT_GRAPH;
+ }
+ }
+
return errors_found;
}