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

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-05-04 20:06:14 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-05-11 13:20:38 +0400
commitc58cac12c24fbb127cf1928bec20decb007a75e8 (patch)
treeb41792fc37e70da0c456926aeb82f311dc3e000c /src/refs.c
parent9bd89d962265b399b537e41058d40a6aeab00e64 (diff)
Introduce a glob-filtering iterator
If the backend doesn't provide support for it, the matching is done in refdb on top of a normal iterator.
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/refs.c b/src/refs.c
index a7be117ad..fc6652fec 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -593,6 +593,16 @@ int git_reference_iterator_new(git_reference_iterator **out, git_repository *rep
return git_refdb_iterator(out, refdb);
}
+int git_reference_iterator_glob_new(git_reference_iterator **out, git_repository *repo, const char *glob)
+{
+ git_refdb *refdb;
+
+ if (git_repository_refdb__weakptr(&refdb, repo) < 0)
+ return -1;
+
+ return git_refdb_iterator_glob(out, refdb, glob);
+}
+
int git_reference_next(const char **out, git_reference_iterator *iter)
{
return git_refdb_next(out, iter);
@@ -928,13 +938,10 @@ int git_reference_foreach_glob(
const char *name;
int error;
- if (git_reference_iterator_new(&iter, repo) < 0)
+ if (git_reference_iterator_glob_new(&iter, repo, glob) < 0)
return -1;
while ((error = git_reference_next(&name, iter)) == 0) {
- if (p_fnmatch(glob, name, 0))
- continue;
-
if (callback(name, payload)) {
error = GIT_EUSER;
goto out;