Re: [PATCH 3/4] midx.c: respect 'pack.writeBitmapHashcache' when writing bitmaps
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Sep 8, 2021, 01:40 UTC
- Message-ID
- <874kavkfjg.fsf@evledraar.gmail.com>
- In-Reply-To
- <be8f47e13c612f2fbe4d5f4f49794529b9424664.1631049462.git.me@ttaylorr.com>
On Tue, Sep 07 2021, Taylor Blau wrote:
Show 28 quoted lines
> +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.