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>2021-01-20 19:04:21 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-23 05:57:27 +0300
commit16b1985be553b5fc6273eb9d7277173623e2d7cb (patch)
tree08a7ce8e52c33ae5b08eeeb4897d438ec0122e18 /refs.h
parent71ca53e8125e36efbda17293c50027d31681a41f (diff)
refs: expose 'for_each_fullref_in_prefixes'
This function was used in the ref-filter.c code to find the longest common prefix of among a set of refspecs, and then to iterate all of the references that descend from that prefix. A future patch will want to use that same code from ls-refs.c, so prepare by exposing and moving it to refs.c. Since there is nothing specific to the ref-filter code here (other than that it was previously the only caller of this function), this really belongs in the more generic refs.h header. The code moved in this patch is identical before and after, with the one exception of renaming some arguments to be consistent with other functions exposed in refs.h. 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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index ff05d2e9fe..c5fd35487d 100644
--- a/refs.h
+++ b/refs.h
@@ -348,6 +348,15 @@ int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data,
unsigned int broken);
/**
+ * iterate all refs in "patterns" by partitioning patterns into disjoint sets
+ * and iterating the longest-common prefix of each set.
+ *
+ * callers should be prepared to ignore references that they did not ask for.
+ */
+int for_each_fullref_in_prefixes(const char *namespace, const char **patterns,
+ each_ref_fn fn, void *cb_data,
+ unsigned int broken);
+/**
* iterate refs from the respective area.
*/
int for_each_tag_ref(each_ref_fn fn, void *cb_data);