Skip to content

Commit 1f7f557

Browse files
avargitster
authored andcommitted
commit-graph verify: add progress output
For the reasons explained in the "commit-graph write: add progress output" commit leading up to this one, emit progress on "commit-graph verify". Since e0fd51e ("fsck: verify commit-graph", 2018-06-27) "git fsck" has called this command if core.commitGraph=true, but there's been no progress output to indicate that anything was different. Now there is (on my tiny dotfiles.git repository): $ git -c core.commitGraph=true -C ~/ fsck Checking object directories: 100% (256/256), done. Checking objects: 100% (2821/2821), done. dangling blob 5b8bbdb9b788ed90459f505b0934619c17cc605b Verifying commits in commit graph: 100% (867/867), done. And on a larger repository, such as the 2015-04-03-1M-git.git test repository: $ time git -c core.commitGraph=true -C ~/g/2015-04-03-1M-git/ commit-graph verify Verifying commits in commit graph: 100% (1000447/1000447), done. real 0m7.813s [...] Since the "commit-graph verify" subcommand is never called from "git gc", we don't have to worry about passing some some "report_progress" progress variable around for this codepath. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7b0f229 commit 1f7f557

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

commit-graph.c

+5
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
922922
int generation_zero = 0;
923923
struct hashfile *f;
924924
int devnull;
925+
struct progress *progress = NULL;
925926

926927
if (!g) {
927928
graph_report("no commit-graph file loaded");
@@ -989,11 +990,14 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
989990
if (verify_commit_graph_error & ~VERIFY_COMMIT_GRAPH_ERROR_HASH)
990991
return verify_commit_graph_error;
991992

993+
progress = start_progress(_("Verifying commits in commit graph"),
994+
g->num_commits);
992995
for (i = 0; i < g->num_commits; i++) {
993996
struct commit *graph_commit, *odb_commit;
994997
struct commit_list *graph_parents, *odb_parents;
995998
uint32_t max_generation = 0;
996999

1000+
display_progress(progress, i + 1);
9971001
hashcpy(cur_oid.hash, g->chunk_oid_lookup + g->hash_len * i);
9981002

9991003
graph_commit = lookup_commit(r, &cur_oid);
@@ -1070,6 +1074,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
10701074
graph_commit->date,
10711075
odb_commit->date);
10721076
}
1077+
stop_progress(&progress);
10731078

10741079
return verify_commit_graph_error;
10751080
}

0 commit comments

Comments
 (0)