Skip to content

Commit eda206f

Browse files
ttaylorrgitster
authored andcommitted
fsck: suppress commit-graph output with --no-progress
Since e0fd51e (fsck: verify commit-graph, 2018-06-27), `fsck` runs `git commit-graph verify` to check the integrity of any commit-graph(s). Originally, the `git commit-graph verify` step would always print to stdout/stderr, regardless of whether or not `fsck` was invoked with `--[no-]progress` or not. But in 7371612 (commit-graph: add --[no-]progress to write and verify, 2019-08-26), the commit-graph machinery learned the `--[no-]progress` option, though `fsck` was not updated to pass this new flag (or not). This led to seeing output from running `git fsck`, even with `--no-progress` on repositories that have a commit-graph: $ git.compile fsck --connectivity-only --no-progress --no-dangling Verifying commits in commit graph: 100% (4356/4356), done. Verifying commits in commit graph: 100% (131912/131912), done. Ensure that `fsck` passes `--[no-]progress` as appropriate when calling `git commit-graph verify`. Signed-off-by: Taylor Blau <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb7d80e commit eda206f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

builtin/fsck.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,10 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
10721072
commit_graph_verify.git_cmd = 1;
10731073
strvec_pushl(&commit_graph_verify.args, "commit-graph",
10741074
"verify", "--object-dir", odb->path, NULL);
1075+
if (show_progress)
1076+
strvec_push(&commit_graph_verify.args, "--progress");
1077+
else
1078+
strvec_push(&commit_graph_verify.args, "--no-progress");
10751079
if (run_command(&commit_graph_verify))
10761080
errors_found |= ERROR_COMMIT_GRAPH;
10771081
}

t/t5318-commit-graph.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,16 @@ test_expect_success 'git fsck (checks commit-graph when config unset)' '
684684
test_must_fail git fsck
685685
'
686686

687+
test_expect_success 'git fsck shows commit-graph output with --progress' '
688+
git -C "$TRASH_DIRECTORY/full" fsck --progress 2>err &&
689+
grep "Verifying commits in commit graph" err
690+
'
691+
692+
test_expect_success 'git fsck suppresses commit-graph output with --no-progress' '
693+
git -C "$TRASH_DIRECTORY/full" fsck --no-progress 2>err &&
694+
! grep "Verifying commits in commit graph" err
695+
'
696+
687697
test_expect_success 'setup non-the_repository tests' '
688698
rm -rf repo &&
689699
git init repo &&

0 commit comments

Comments
 (0)