Subject: Re: ds/midx-with-less-memory

From: Junio C Hamano <[email-masked]>
Date: Wed, 27 Jul 2022 08:10:51 -0700

Jeff King <[email-masked]> writes:

> On Fri, Jul 22, 2022 at 06:01:10PM -0700, Junio C Hamano wrote:
>
>> * ds/midx-with-less-memory (2022-07-19) 3 commits
>>   (merged to 'next' on 2022-07-20 at 250d257c3e)
>>  + midx: reduce memory pressure while writing bitmaps
>>  + midx: extract bitmap write setup
>>  + pack-bitmap-write: use const for hashes
>> 
>>  The codepath to write multi-pack index has been taught to release a
>>  large chunk of memory that holds an array of objects in the packs,
>>  as soon as it is done with the array, to reduce memory consumption.
>> 
>>  Will merge to 'master'.
>>  source: <[email-masked]>
>
> This topic looks very nice, but I think we might want this additional
> cleanup on top:
>
> -- >8 --
> Subject: [PATCH] write_midx_bitmap(): drop unused refs_snapshot parameter
>
> The refactoring in 90b2bb710d (midx: extract bitmap write setup,
> 2022-07-19) hoisted our call to find_commits_for_midx_bitmap() into the
> caller, which means we no longer need to see the refs_snapshot at all.
>
> Signed-off-by: Jeff King <[email-masked]>
> ---
>  midx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Nice.  Is this -Wunused-parameter at work?

Thanks, will queue.

> diff --git a/midx.c b/midx.c
> index 772ab7d294..4e956cacb7 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -1059,7 +1059,6 @@ static int write_midx_bitmap(const char *midx_name,
>  			     struct commit **commits,
>  			     uint32_t commits_nr,
>  			     uint32_t *pack_order,
> -			     const char *refs_snapshot,
>  			     unsigned flags)
>  {
>  	int ret, i;
> @@ -1462,7 +1461,7 @@ static int write_midx_internal(const char *object_dir,
>  
>  		if (write_midx_bitmap(midx_name.buf, midx_hash, &pdata,
>  				      commits, commits_nr, ctx.pack_order,
> -				      refs_snapshot, flags) < 0) {
> +				      flags) < 0) {
>  			error(_("could not write multi-pack bitmap"));
>  			result = 1;
>  			goto cleanup;