]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
revision.h: store hidden refs in a `strvec`
authorTaylor Blau <me@ttaylorr.com>
Mon, 10 Jul 2023 21:12:33 +0000 (17:12 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2023 21:48:56 +0000 (14:48 -0700)
commitc45841fff8f444cc61cecd42e5d2032844ecbe24
treed046ae5003fbf8c96707bde25067441c4599a90d
parentc489f47a649da8984a2240032e1d819e9a80ea2a
revision.h: store hidden refs in a `strvec`

In subsequent commits, it will be convenient to have a 'const char **'
of hidden refs (matching `transfer.hiderefs`, `uploadpack.hideRefs`,
etc.), instead of a `string_list`.

Convert spots throughout the tree that store the list of hidden refs
from a `string_list` to a `strvec`.

Note that in `parse_hide_refs_config()` there is an ugly const-cast used
to avoid an extra copy of each value before trimming any trailing slash
characters. This could instead be written as:

    ref = xstrdup(value);
    len = strlen(ref);
    while (len && ref[len - 1] == '/')
            ref[--len] = '\0';
    strvec_push(hide_refs, ref);
    free(ref);

but the double-copy (once when calling `xstrdup()`, and another via
`strvec_push()`) is wasteful.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
ls-refs.c
refs.c
refs.h
revision.c
revision.h
upload-pack.c