summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2012-06-05 14:48:51 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-07-03 12:50:51 +0200
commit521aedad307c6f72d6f6d660943508b2b015f6dd (patch)
treeaef33032b13ca170a3d7a016e7e8522a7635ce6f /src/odb.c
parente560aa8ffa7cf143fbd34a5aec44741ae4c77271 (diff)
downloadlibgit2-521aedad307c6f72d6f6d660943508b2b015f6dd.tar.gz
odb: add git_odb_foreach()
Go through each backend and list every objects that exists in them. This allows fsck-like uses.
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/odb.c b/src/odb.c
index e0c8fa262..493c8292a 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -605,6 +605,18 @@ int git_odb_read_prefix(
return 0;
}
+int git_odb_foreach(git_odb *db, int (*cb)(git_oid *oid, void *data), void *data)
+{
+ unsigned int i;
+ backend_internal *internal;
+ git_vector_foreach(&db->backends, i, internal) {
+ git_odb_backend *b = internal->backend;
+ b->foreach(b, cb, data);
+ }
+
+ return 0;
+}
+
int git_odb_write(
git_oid *oid, git_odb *db, const void *data, size_t len, git_otype type)
{