Subject: Re: [PATCH 3/4] midx.c: respect 'pack.writeBitmapHashcache' when writing bitmaps

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 08 Sep 2021 03:40:19 +0200

On Tue, Sep 07 2021, Taylor Blau wrote:

> +static int git_multi_pack_index_write_config(const char *var, const char *value,
> +					     void *cb)
> +{
> +	if (!strcmp(var, "pack.writebitmaphashcache")) {
> +		if (git_config_bool(var, value))
> +			opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
> +		else
> +			opts.flags &= ~MIDX_WRITE_BITMAP_HASH_CACHE;
> +	}
> +
> +	/*
> +	 * No need to fall-back to 'git_default_config', since this was already
> +	 * called in 'cmd_multi_pack_index()'.
> +	 */
> +	return 0;
> +}
> +
>  static int cmd_multi_pack_index_write(int argc, const char **argv)
>  {
>  	struct option *options;
> @@ -73,6 +90,10 @@ static int cmd_multi_pack_index_write(int argc, const char **argv)
>  		OPT_END(),
>  	};
>  
> +	opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
> +
> +	git_config(git_multi_pack_index_write_config, NULL);
> +

Since this is a write-only config option it would seem more logical to
just call git_config() once, and have a git_multip_pack_index_config,
which then would fall back on git_default_config, so we iterate it once,
and no need for a comment about the oddity.