Re: [PATCH 2/2] commit-graph verify: add progress output

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

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> For the reasons explained in the "commit-graph write: add progress
> output" commit leading up to this one, emit progress on "commit-graph
> verify". Since e0fd51e1d7 ("fsck: verify commit-graph", 2018-06-27)
> "git fsck" has called this command if core.commitGraph=true, but
> there's been no progress output to indicate that anything was
> different. Now there is (on my tiny dotfiles.git repository):
>
>     $ git -c core.commitGraph=true -C ~/ fsck
>     Checking object directories: 100% (256/256), done.
>     Checking objects: 100% (2821/2821), done.
>     dangling blob 5b8bbdb9b788ed90459f505b0934619c17cc605b
>     Verifying commits in commit graph: 100% (867/867), done.
>
> And on a larger repository, such as the 2015-04-03-1M-git.git test
> repository:
>
>     $ time git -c core.commitGraph=true -C ~/g/2015-04-03-1M-git/ commit-graph verify
>     Verifying commits in commit graph: 100% (1000447/1000447), done.
>     real    0m7.813s
>     [...]
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  commit-graph.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Yup.  The verification side knows the total number of things, so it
is much easier to give the percentage progress with a very simple
addition like this, which is very nice.



>
> diff --git a/commit-graph.c b/commit-graph.c
> index 74889dc90a..1a02fe019a 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -914,6 +914,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
>  	int generation_zero = 0;
>  	struct hashfile *f;
>  	int devnull;
> +	struct progress *progress = NULL;
>  
>  	if (!g) {
>  		graph_report("no commit-graph file loaded");
> @@ -981,11 +982,14 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
>  	if (verify_commit_graph_error & ~VERIFY_COMMIT_GRAPH_ERROR_HASH)
>  		return verify_commit_graph_error;
>  
> +	progress = start_progress("Verifying commits in commit graph",
> +				  g->num_commits);
>  	for (i = 0; i < g->num_commits; i++) {
>  		struct commit *graph_commit, *odb_commit;
>  		struct commit_list *graph_parents, *odb_parents;
>  		uint32_t max_generation = 0;
>  
> +		display_progress(progress, i);
>  		hashcpy(cur_oid.hash, g->chunk_oid_lookup + g->hash_len * i);
>  
>  		graph_commit = lookup_commit(r, &cur_oid);
> @@ -1062,6 +1066,8 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
>  				     graph_commit->date,
>  				     odb_commit->date);
>  	}
> +	display_progress(progress, i);
> +	stop_progress(&progress);
>  
>  	return verify_commit_graph_error;
>  }



[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