Subject: [PATCH] commit-graph: don't show progress percentages while expanding reachable commits

From: SZEDER Gábor <[email-masked]>
Date: Fri, 22 Mar 2019 11:28:17 +0100

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.

Signed-off-by: SZEDER Gábor <[email-masked]>
---
 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);
-- 
2.21.0.539.g07239c3a71.dirty