diff --git a/builtin/fsck.c b/builtin/fsck.c index dcc165bf0c..915dc8b9b3 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -1072,6 +1072,10 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) commit_graph_verify.git_cmd = 1; strvec_pushl(&commit_graph_verify.args, "commit-graph", "verify", "--object-dir", odb->path, NULL); + if (show_progress) + strvec_push(&commit_graph_verify.args, "--progress"); + else + strvec_push(&commit_graph_verify.args, "--no-progress"); if (run_command(&commit_graph_verify)) errors_found |= ERROR_COMMIT_GRAPH; } diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index b6e1211578..bf8a92317b 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -684,6 +684,16 @@ test_expect_success 'git fsck (checks commit-graph when config unset)' ' test_must_fail git fsck ' +test_expect_success 'git fsck shows commit-graph output with --progress' ' + git -C "$TRASH_DIRECTORY/full" fsck --progress 2>err && + grep "Verifying commits in commit graph" err +' + +test_expect_success 'git fsck suppresses commit-graph output with --no-progress' ' + git -C "$TRASH_DIRECTORY/full" fsck --no-progress 2>err && + ! grep "Verifying commits in commit graph" err +' + test_expect_success 'setup non-the_repository tests' ' rm -rf repo && git init repo &&