diff options
author | Taylor Blau <me@ttaylorr.com> | 2023-07-10 23:12:33 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-10 23:48:56 +0200 |
commit | c45841fff8f444cc61cecd42e5d2032844ecbe24 (patch) | |
tree | d046ae5003fbf8c96707bde25067441c4599a90d /revision.h | |
parent | refs/packed-backend.c: add trace2 counters for jump list (diff) | |
download | git-c45841fff8f444cc61cecd42e5d2032844ecbe24.tar.xz git-c45841fff8f444cc61cecd42e5d2032844ecbe24.zip |
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>
Diffstat (limited to 'revision.h')
-rw-r--r-- | revision.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/revision.h b/revision.h index 31828748dc..94f035fa22 100644 --- a/revision.h +++ b/revision.h @@ -10,6 +10,7 @@ #include "decorate.h" #include "ident.h" #include "list-objects-filter-options.h" +#include "strvec.h" /** * The revision walking API offers functions to build a list of revisions @@ -95,7 +96,7 @@ struct ref_exclusions { * Hidden refs is a list of patterns that is to be hidden via * `ref_is_hidden()`. */ - struct string_list hidden_refs; + struct strvec hidden_refs; /* * Indicates whether hidden refs have been configured. This is to @@ -110,7 +111,7 @@ struct ref_exclusions { */ #define REF_EXCLUSIONS_INIT { \ .excluded_refs = STRING_LIST_INIT_DUP, \ - .hidden_refs = STRING_LIST_INIT_DUP, \ + .hidden_refs = STRVEC_INIT, \ } struct oidset; |