summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-07-10 21:12:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-07-10 21:48:56 (GMT)
commitc45841fff8f444cc61cecd42e5d2032844ecbe24 (patch)
treed046ae5003fbf8c96707bde25067441c4599a90d /revision.c
parentc489f47a649da8984a2240032e1d819e9a80ea2a (diff)
downloadgit-c45841fff8f444cc61cecd42e5d2032844ecbe24.zip
git-c45841fff8f444cc61cecd42e5d2032844ecbe24.tar.gz
git-c45841fff8f444cc61cecd42e5d2032844ecbe24.tar.bz2
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.c')
-rw-r--r--revision.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/revision.c b/revision.c
index 8995359..7c9367a 100644
--- a/revision.c
+++ b/revision.c
@@ -1558,7 +1558,7 @@ void init_ref_exclusions(struct ref_exclusions *exclusions)
void clear_ref_exclusions(struct ref_exclusions *exclusions)
{
string_list_clear(&exclusions->excluded_refs, 0);
- string_list_clear(&exclusions->hidden_refs, 0);
+ strvec_clear(&exclusions->hidden_refs);
exclusions->hidden_refs_configured = 0;
}