summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2012-11-05 11:33:10 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2012-11-05 16:00:29 -0600
commit09cc0b92dc60c726180cda36643e263c32d9a812 (patch)
tree8b07bb41b327e75c6c92616ec891809b11552ed7 /src/odb.c
parenta5e85d86b7e13352c553b0a43bc36fee5880b5c7 (diff)
downloadlibgit2-09cc0b92dc60c726180cda36643e263c32d9a812.tar.gz
create callback to handle packs from fetch, move the indexer to odb_pack
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/odb.c b/src/odb.c
index 7c21598f0..d6b1de946 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -766,6 +766,31 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi
return error;
}
+int git_odb_write_pack(struct git_odb_writepack **out, git_odb *db, git_transfer_progress_callback progress_cb, void *progress_payload)
+{
+ unsigned int i;
+ int error = GIT_ERROR;
+
+ assert(out && db);
+
+ for (i = 0; i < db->backends.length && error < 0; ++i) {
+ backend_internal *internal = git_vector_get(&db->backends, i);
+ git_odb_backend *b = internal->backend;
+
+ /* we don't write in alternates! */
+ if (internal->is_alternate)
+ continue;
+
+ if (b->writepack != NULL)
+ error = b->writepack(out, b, progress_cb, progress_payload);
+ }
+
+ if (error == GIT_PASSTHROUGH)
+ error = 0;
+
+ return error;
+}
+
void * git_odb_backend_malloc(git_odb_backend *backend, size_t len)
{
GIT_UNUSED(backend);