Re: [PATCH v4 1/6] refs: get rid of global list of hidden refs
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 8, 2022, 13:36 UTC
- Message-ID
- <221108.86leolsgze.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <34afe30d60e4dbc7e50a590541440c20c27507a6.1667901510.git.ps@pks.im>
On Tue, Nov 08 2022, Patrick Steinhardt wrote:
Show 5 quoted lines
> @@ -2591,6 +2592,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) > packet_flush(1); > oid_array_clear(&shallow); > oid_array_clear(&ref); > + string_list_clear(&hidden_refs, 1);
In the v4 re-roll you got rid of the "1" for some other string_lists, but is this one still needed, i.e. does it use "util"? At a glance it doesn't seem so. There's another "hidden_refs" (maybe just semi-related) in 4/6 that doesn't use it when clearing.
Show 30 quoted lines
> diff --git a/refs.c b/refs.c
> index 1491ae937e..2c7e88b190 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1414,9 +1414,8 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
> refname, strict);
> }
>
> -static struct string_list *hide_refs;
> -
> -int parse_hide_refs_config(const char *var, const char *value, const char *section)
> +int parse_hide_refs_config(const char *var, const char *value, const char *section,
> + struct string_list *hide_refs)
> {
> const char *key;
> if (!strcmp("transfer.hiderefs", var) ||
> @@ -1431,21 +1430,16 @@ int parse_hide_refs_config(const char *var, const char *value, const char *secti
> len = strlen(ref);
> while (len && ref[len - 1] == '/')
> ref[--len] = '\0';
> - if (!hide_refs) {
> - CALLOC_ARRAY(hide_refs, 1);
> - hide_refs->strdup_strings = 1;
> - }
> - string_list_append(hide_refs, ref);
> + string_list_append_nodup(hide_refs, ref);
> }
> return 0;
> }
> As before, this is all much nicer, thanks.