diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-05-28 20:47:55 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-05-28 20:47:55 +0200 |
commit | 56960b8396d3aef0b39f32aa7a9749202f925ada (patch) | |
tree | 90148977efa5b5dd715ddc4e474732737320314e /src/refdb.c | |
parent | 2638a03affdf57c989f573d48afca3b849cb4c1f (diff) | |
download | libgit2-56960b8396d3aef0b39f32aa7a9749202f925ada.tar.gz |
Liike this
Diffstat (limited to 'src/refdb.c')
-rw-r--r-- | src/refdb.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/refdb.c b/src/refdb.c index 9f9037ce7..6cb879288 100644 --- a/src/refdb.c +++ b/src/refdb.c @@ -160,17 +160,26 @@ int git_refdb_iterator_glob(git_reference_iterator **out, git_refdb *db, const c return 0; } -int git_refdb_next(const char **out, git_reference_iterator *iter) +int git_refdb_next(git_reference **out, git_reference_iterator *iter) { int error; - if (!iter->glob) - return iter->backend->next(out, iter); + if (!iter->glob) { + if ((error = iter->backend->next(out, iter)) < 0) + return error; + + (*out)->db = iter->backend; + return 0; + } /* If the iterator has a glob, we need to filter */ while ((error = iter->backend->next(out, iter)) == 0) { - if (!p_fnmatch(iter->glob, *out, 0)) - break; + if (!p_fnmatch(iter->glob, (*out)->name, 0)) { + (*out)->db = iter->backend; + return 0; + } + + git_reference_free(*out); } return error; |