path: root/builtin/fsck.c
diff options
authorGlen Choo <>2021-10-15 20:16:29 (GMT)
committerJunio C Hamano <>2021-10-15 21:30:07 (GMT)
commitf30e4d854bb8462d1a4da697ad95501d33fe4425 (patch)
tree1ae521bc15646602e65c7ec7353a6b2f66c54596 /builtin/fsck.c
parented41385ad65ebf5d6341db96728be357dde3194d (diff)
fsck: verify commit graph when implicitly enabled
Change fsck to check the "core_commit_graph" variable set in "repo-settings.c" instead of reading the "core.commitGraph" variable. This fixes a bug where we wouldn't verify the commit-graph if the config key was missing. This bug was introduced in 31b1de6a09 (commit-graph: turn on commit-graph by default, 2019-08-13), where core.commitGraph was turned on by default. Add tests to "" to verify that fsck checks the commit-graph as expected for the 3 values of core.commitGraph. Also, disable GIT_TEST_COMMIT_GRAPH in t/ because some test cases use fsck in ways that assume that commit-graph checking is disabled. Helped-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Glen Choo <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/fsck.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index b42b6fe..1c4e485 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -803,6 +803,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
git_config(git_fsck_config, &fsck_obj_options);
+ prepare_repo_settings(the_repository);
if (connectivity_only) {
for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
@@ -908,7 +909,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
- if (!git_config_get_bool("core.commitgraph", &i) && i) {
+ if (the_repository->settings.core_commit_graph) {
struct child_process commit_graph_verify = CHILD_PROCESS_INIT;
const char *verify_argv[] = { "commit-graph", "verify", NULL, NULL, NULL };