aboutsummaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index 5190e98b2c..bb9c64a51c 100644
--- a/refs.h
+++ b/refs.h
@@ -453,8 +453,37 @@ int refs_head_ref(struct ref_store *refs,
int refs_head_ref_namespaced(struct ref_store *refs,
refs_for_each_cb fn, void *cb_data);
+
+struct refs_for_each_ref_options {
+ /* Only iterate over references that have this given prefix. */
+ const char *prefix;
+
+ /*
+ * Exclude any references that match any of these patterns on a
+ * best-effort basis. The caller needs to be prepared for the exclude
+ * patterns to be ignored.
+ *
+ * The array must be terminated with a NULL sentinel value.
+ */
+ const char **exclude_patterns;
+
+ /*
+ * The number of bytes to trim from the refname. Note that the trimmed
+ * bytes must not cause the reference to become empty. As such, this
+ * field should typically only be set when one uses a `prefix` ending
+ * in a slash.
+ */
+ size_t trim_prefix;
+
+ /* Flags that change which refs will be included. */
+ enum refs_for_each_flag flags;
+};
+
int refs_for_each_ref(struct ref_store *refs,
refs_for_each_cb fn, void *cb_data);
+int refs_for_each_ref_ext(struct ref_store *refs,
+ refs_for_each_cb cb, void *cb_data,
+ const struct refs_for_each_ref_options *opts);
int refs_for_each_ref_in(struct ref_store *refs, const char *prefix,
refs_for_each_cb fn, void *cb_data);
int refs_for_each_tag_ref(struct ref_store *refs,