On Fri, Mar 22, 2019 at 12:11:26PM +0100, Ævar Arnfjörð Bjarmason wrote: > > On Fri, Mar 22 2019, SZEDER Gábor wrote: > > > Commit 49bbc57a57 (commit-graph write: emit a percentage for all > > progress, 2019-01-19) was a bit overeager when it added progress > > percentages to the "Expanding reachable commits in commit graph" phase > > as well, because most of the time the number of commits that phase has > > to iterate over is not known in advance and grows significantly, and, > > consequently, we end up with nonsensical numbers: > > > > $ git commit-graph write --reachable > > Expanding reachable commits in commit graph: 138606% (824706/595), done. > > [...] > > > > $ git rev-parse v5.0 | git commit-graph write --stdin-commits > > Expanding reachable commits in commit graph: 81264400% (812644/1), done. > > [...] > > > > Therefore, don't show progress percentages in the "Expanding reachable > > commits in commit graph" phase. > > There's indeed a bug here as your examples show, but there *are* cases > where it's correct, as the commit message for my patch on "master" shows > there's cases where we correctly. > > So this "fixes" things by always removing the progress, why not instead > pass down the state to close_reachable() about what we're walking over, > so we can always show progress, or at least in some cases? The cases where it does display correct percentages are exceptional, and doesn't worth the effort to try to find out whether ther current operation happens to be such a case. > > Signed-off-by: SZEDER Gábor <szeder.dev@xxxxxxxxx> > > --- > > commit-graph.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/commit-graph.c b/commit-graph.c > > index 017225ccea..60c06ce58f 100644 > > --- a/commit-graph.c > > +++ b/commit-graph.c > > @@ -672,13 +672,13 @@ static void close_reachable(struct packed_oid_list *oids, int report_progress) > > * As this loop runs, oids->nr may grow, but not more > > * than the number of missing commits in the reachable > > * closure. > > */ > > if (report_progress) > > progress = start_delayed_progress( > > - _("Expanding reachable commits in commit graph"), oids->nr); > > + _("Expanding reachable commits in commit graph"), 0); > > for (i = 0; i < oids->nr; i++) { > > display_progress(progress, i + 1); > > commit = lookup_commit(the_repository, &oids->list[i]); > > > > if (commit && !parse_commit(commit)) > > add_missing_parents(oids, commit);