Skip to content

Commit 49bbc57

Browse files
avargitster
authored andcommitted
commit-graph write: emit a percentage for all progress
Follow-up 01ca387 ("commit-graph: split up close_reachable() progress output", 2018-11-19) by making the progress bars in close_reachable() report a completion percentage. This fixes the last occurrence where in the commit graph writing where we didn't report that. The change in 01ca387 split up the 1x progress bar in close_reachable() into 3x, but left them as dumb counters without a percentage completion. Fixing that is easy, and the only reason it wasn't done already is because that commit was rushed in during the v2.20.0 RC period to fix the unrelated issue of over-reporting commit numbers. See [1] and follow-ups for ML activity at the time and [2] for an alternative approach where the progress bars weren't split up. Now for e.g. linux.git we'll emit: $ ~/g/git/git --exec-path=$HOME/g/git commit-graph write Finding commits for commit graph among packed objects: 100% (6529159/6529159), done. Expanding reachable commits in commit graph: 100% (815990/815980), done. Computing commit graph generation numbers: 100% (815983/815983), done. Writing out commit graph in 4 passes: 100% (3263932/3263932), done. 1. https://public-inbox.org/git/20181119202300.18670-1-avarab@gmail.com/ 2. https://public-inbox.org/git/20181122153922.16912-11-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 890226c commit 49bbc57

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

commit-graph.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,15 @@ static void add_missing_parents(struct packed_oid_list *oids, struct commit *com
653653

654654
static void close_reachable(struct packed_oid_list *oids, int report_progress)
655655
{
656-
int i, j;
656+
int i;
657657
struct commit *commit;
658658
struct progress *progress = NULL;
659659

660660
if (report_progress)
661661
progress = start_delayed_progress(
662-
_("Loading known commits in commit graph"), j = 0);
662+
_("Loading known commits in commit graph"), oids->nr);
663663
for (i = 0; i < oids->nr; i++) {
664-
display_progress(progress, ++j);
664+
display_progress(progress, i + 1);
665665
commit = lookup_commit(the_repository, &oids->list[i]);
666666
if (commit)
667667
commit->object.flags |= UNINTERESTING;
@@ -675,9 +675,9 @@ static void close_reachable(struct packed_oid_list *oids, int report_progress)
675675
*/
676676
if (report_progress)
677677
progress = start_delayed_progress(
678-
_("Expanding reachable commits in commit graph"), j = 0);
678+
_("Expanding reachable commits in commit graph"), oids->nr);
679679
for (i = 0; i < oids->nr; i++) {
680-
display_progress(progress, ++j);
680+
display_progress(progress, i + 1);
681681
commit = lookup_commit(the_repository, &oids->list[i]);
682682

683683
if (commit && !parse_commit(commit))
@@ -687,9 +687,9 @@ static void close_reachable(struct packed_oid_list *oids, int report_progress)
687687

688688
if (report_progress)
689689
progress = start_delayed_progress(
690-
_("Clearing commit marks in commit graph"), j = 0);
690+
_("Clearing commit marks in commit graph"), oids->nr);
691691
for (i = 0; i < oids->nr; i++) {
692-
display_progress(progress, ++j);
692+
display_progress(progress, i + 1);
693693
commit = lookup_commit(the_repository, &oids->list[i]);
694694

695695
if (commit)

0 commit comments

Comments
 (0)