summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-10-11 15:48:29 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-11 02:36:11 +0100
commit04a36feff152fef2fd5f45c46b5cf25e84c7099f (patch)
treec037954110cd0af20e04882e5ba0049975d77fe9 /include
parentb63b76e0b0b658dff328e0d9e109ce040830786c (diff)
downloadlibgit2-04a36feff152fef2fd5f45c46b5cf25e84c7099f.tar.gz
pack-objects: fill a packbuilder from a walk
Most use-cases for the object packer communicate in terms of commits which each side has. We already have an object to specify this relationship between commits, namely git_revwalk. By knowing which commits we want to pack and which the other side already has, we can perform similar optimisations to git, by marking each tree as interesting or uninteresting only once, and not sending those trees which we know the other side has.
Diffstat (limited to 'include')
-rw-r--r--include/git2/pack.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/pack.h b/include/git2/pack.h
index e7f060d12..4cf426273 100644
--- a/include/git2/pack.h
+++ b/include/git2/pack.h
@@ -115,6 +115,19 @@ GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *
GIT_EXTERN(int) git_packbuilder_insert_commit(git_packbuilder *pb, const git_oid *id);
/**
+ * Insert objects as given by the walk
+ *
+ * Those commits and all objects they reference will be inserted into
+ * the packbuilder.
+ *
+ * @param pb the packbuilder
+ * @param walk the revwalk to use to fill the packbuilder
+ *
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk);
+
+/**
* Write the contents of the packfile to an in-memory buffer
*
* The contents of the buffer will become a valid packfile, even though there