Subject: Re: [PATCH v5 3/9] commit-graph write: add "Writing out" progress output

From: SZEDER Gábor <[email-masked]>
Date: Fri, 18 Jan 2019 18:16:05 +0100

On Wed, Jan 16, 2019 at 02:29:41PM +0100, Ævar Arnfjörð Bjarmason wrote:
> @@ -941,11 +957,25 @@ void write_commit_graph(const char *obj_dir,
>  		hashwrite(f, chunk_write, 12);
>  	}
>  
> -	write_graph_chunk_fanout(f, commits.list, commits.nr);
> -	write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr);
> -	write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr);
> +	if (report_progress) {
> +		/*
> +		 * Each of the write_graph_chunk_*() functions just
> +		 * below loops over our N commits. This number must be
> +		 * kept in sync with the number of passes we're doing.
> +		 */
> +		int graph_passes = 3;
> +		if (num_large_edges)
> +			graph_passes++;

write_commit_graph() already has the 'num_chunks' variable, which
holds exactly the right value.

> +		progress = start_delayed_progress(
> +			_("Writing out commit graph"),
> +			graph_passes * commits.nr);
> +	}
> +	write_graph_chunk_fanout(f, commits.list, commits.nr, progress, &progress_cnt);
> +	write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr, progress, &progress_cnt);
> +	write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr, progress, &progress_cnt);
>  	if (num_large_edges)
> -		write_graph_chunk_large_edges(f, commits.list, commits.nr);
> +		write_graph_chunk_large_edges(f, commits.list, commits.nr, progress, &progress_cnt);
> +	stop_progress(&progress);
>  
>  	close_commit_graph(the_repository);
>  	finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);
> -- 
> 2.20.1.153.gd81d796ee0
>