Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-07-11 00:12:33 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-11 00:48:56 +0300
commitc45841fff8f444cc61cecd42e5d2032844ecbe24 (patch)
treed046ae5003fbf8c96707bde25067441c4599a90d /ls-refs.c
parentc489f47a649da8984a2240032e1d819e9a80ea2a (diff)
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 'ls-refs.c')
-rw-r--r--ls-refs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ls-refs.c b/ls-refs.c
index 6f490b2d9c..8c3181d051 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -72,7 +72,7 @@ struct ls_refs_data {
unsigned symrefs;
struct strvec prefixes;
struct strbuf buf;
- struct string_list hidden_refs;
+ struct strvec hidden_refs;
unsigned unborn : 1;
};
@@ -155,7 +155,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
memset(&data, 0, sizeof(data));
strvec_init(&data.prefixes);
strbuf_init(&data.buf, 0);
- string_list_init_dup(&data.hidden_refs);
+ strvec_init(&data.hidden_refs);
git_config(ls_refs_config, &data);
@@ -197,7 +197,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
packet_fflush(stdout);
strvec_clear(&data.prefixes);
strbuf_release(&data.buf);
- string_list_clear(&data.hidden_refs, 0);
+ strvec_clear(&data.hidden_refs);
return 0;
}