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_fs.c | |
parent | 2638a03affdf57c989f573d48afca3b849cb4c1f (diff) | |
download | libgit2-56960b8396d3aef0b39f32aa7a9749202f925ada.tar.gz |
Liike this
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r-- | src/refdb_fs.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 97f0b07c4..457964570 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -645,16 +645,19 @@ static int iter_load_loose_paths(refdb_fs_iter *iter) return 0; } -static int refdb_fs_backend__next(const char **out, git_reference_iterator *_iter) +static int refdb_fs_backend__next(git_reference **out, git_reference_iterator *_iter) { refdb_fs_iter *iter = (refdb_fs_iter *)_iter; - refdb_fs_backend *backend = (refdb_fs_backend *) iter->parent.backend; + refdb_fs_backend *backend = (refdb_fs_backend *)iter->parent.backend; git_strmap *packfile = backend->refcache.packfile; - if (iter->loose_pos < iter->loose.length) { + while (iter->loose_pos < iter->loose.length) { const char *path = git_vector_get(&iter->loose, iter->loose_pos++); - *out = path; - return 0; + + if (loose_lookup(out, backend, path) == 0) + return 0; + + giterr_clear(); } if (iter->packed_pos < kh_end(packfile)) { @@ -671,7 +674,10 @@ static int refdb_fs_backend__next(const char **out, git_reference_iterator *_ite iter->packed_pos++; } while (ref->flags & PACKREF_SHADOWED); - *out = ref->name; + *out = git_reference__alloc(ref->name, &ref->oid, &ref->peel); + if (*out == NULL) + return -1; + return 0; } |