[PATCH v3 10/10] commit-graph write: emit a percentage for all progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change the "Annotating commit graph" progress output to show a
completion percentage. I added this in 7b0f229222 ("commit-graph
write: add progress output", 2018-09-17) and evidently didn't notice
how easy it was to add a completion percentage.

Now for the very large test repository mentioned in previous commits
we'll emit (shows all progress output):

    Finding commits for commit graph among packed objects: 100% (48333911/48333911), done.
    Annotating commit graph: 100% (21435984/21435984), done.
    Counting distinct commits in commit graph: 100% (7145328/7145328), done.
    Finding extra edges in commit graph: 100% (7145328/7145328), done.
    Computing commit graph generation numbers: 100% (7145328/7145328), done.
    Writing out commit graph in 5 passes: 100% (35726640/35726640), done.

And for linux.git:

    Finding commits for commit graph among packed objects: 100% (6365442/6365442), done.
    Annotating commit graph: 100% (2391666/2391666), done.
    Computing commit graph generation numbers: 100% (797222/797222), done.
    Writing out commit graph in 5 passes: 100% (3986110/3986110), done.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 commit-graph.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/commit-graph.c b/commit-graph.c
index a6e6eeb56b..c893466042 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -660,10 +660,17 @@ static void close_reachable(struct packed_oid_list *oids, int report_progress)
 	struct commit *commit;
 	struct progress *progress = NULL;
 	int j = 0;
+	/*
+	 * We loop over the OIDs N times to close the graph
+	 * below. This number must be kept in sync with the number of
+	 * passes.
+	 */
+	const int oid_passes = 3;
 
 	if (report_progress)
 		progress = start_delayed_progress(
-			_("Annotating commit graph"), 0);
+			_("Annotating commit graph"),
+			oid_passes * oids->nr);
 	for (i = 0; i < oids->nr; i++) {
 		display_progress(progress, ++j);
 		commit = lookup_commit(the_repository, &oids->list[i]);
-- 
2.20.0.rc0.387.gc7a69e6b6c




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux