Skip to content

Commit 7248857

Browse files
ttaylorrgitster
authored andcommitted
commit-graph.c: pass progress to verify_one_commit_graph()
This is the final step to prepare for consolidating the output of `git commit-graph verify`. Instead of having each call to `verify_one_commit_graph()` initialize its own progress struct, have the caller pass one in instead. This patch does not alter the output of `git commit-graph verify`, but the next commit will consolidate the output. Signed-off-by: Taylor Blau <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5facaa commit 7248857

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

commit-graph.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,12 +2545,11 @@ static int commit_graph_checksum_valid(struct commit_graph *g)
25452545

25462546
static int verify_one_commit_graph(struct repository *r,
25472547
struct commit_graph *g,
2548-
int flags)
2548+
struct progress *progress)
25492549
{
25502550
uint32_t i, cur_fanout_pos = 0;
25512551
struct object_id prev_oid, cur_oid;
25522552
int generation_zero = 0;
2553-
struct progress *progress = NULL;
25542553

25552554
verify_commit_graph_error = verify_commit_graph_lite(g);
25562555
if (verify_commit_graph_error)
@@ -2601,10 +2600,6 @@ static int verify_one_commit_graph(struct repository *r,
26012600
if (verify_commit_graph_error & ~VERIFY_COMMIT_GRAPH_ERROR_HASH)
26022601
return verify_commit_graph_error;
26032602

2604-
if (flags & COMMIT_GRAPH_WRITE_PROGRESS)
2605-
progress = start_progress(_("Verifying commits in commit graph"),
2606-
g->num_commits);
2607-
26082603
for (i = 0; i < g->num_commits; i++) {
26092604
struct commit *graph_commit, *odb_commit;
26102605
struct commit_list *graph_parents, *odb_parents;
@@ -2694,7 +2689,6 @@ static int verify_one_commit_graph(struct repository *r,
26942689
graph_commit->date,
26952690
odb_commit->date);
26962691
}
2697-
stop_progress(&progress);
26982692

26992693
return verify_commit_graph_error;
27002694
}
@@ -2709,9 +2703,16 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
27092703
}
27102704

27112705
for (; g; g = g->base_graph) {
2712-
local_error |= verify_one_commit_graph(r, g, flags);
2706+
struct progress *progress = NULL;
2707+
if (flags & COMMIT_GRAPH_WRITE_PROGRESS)
2708+
progress = start_progress(_("Verifying commits in commit graph"),
2709+
g->num_commits);
2710+
2711+
local_error |= verify_one_commit_graph(r, g, progress);
27132712
if (flags & COMMIT_GRAPH_VERIFY_SHALLOW)
27142713
break;
2714+
2715+
stop_progress(&progress);
27152716
}
27162717

27172718
return local_error;

0 commit comments

Comments
 (0)