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
path: root/refs.h
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-07-11 00:12:39 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-11 00:48:56 +0300
commit15af64dcfd176b65cdb938e9b7f27adb8aabffa4 (patch)
treece98614a9e078badeabefda1a664378301b8bf22 /refs.h
parente6bf24d39a6a85e0a2257f22bffc09b9df749b4a (diff)
refs.h: implement `hidden_refs_to_excludes()`
In subsequent commits, we'll teach `receive-pack` and `upload-pack` to use the new jump list feature in the packed-refs iterator by ignoring references which are mentioned via its respective hideRefs lists. However, the packed-ref jump lists cannot handle un-hiding rules (that begin with '!'), or namespace comparisons (that begin with '^'). Add a convenience function to the refs.h API to detect when either of these conditions are met, and returns an appropriate value to pass as excluded patterns. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index 7152e0a09f..a8924d374c 100644
--- a/refs.h
+++ b/refs.h
@@ -831,6 +831,12 @@ int parse_hide_refs_config(const char *var, const char *value, const char *,
*/
int ref_is_hidden(const char *, const char *, const struct strvec *);
+/*
+ * Returns an array of patterns to use as excluded_patterns, if none of the
+ * hidden references use the token '!' or '^'.
+ */
+const char **hidden_refs_to_excludes(const struct strvec *hide_refs);
+
/* Is this a per-worktree ref living in the refs/ namespace? */
int is_per_worktree_ref(const char *refname);