summaryrefslogtreecommitdiff
path: root/src/pack-objects.h
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 /src/pack-objects.h
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 'src/pack-objects.h')
-rw-r--r--src/pack-objects.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pack-objects.h b/src/pack-objects.h
index 4647df75a..9af5c0b09 100644
--- a/src/pack-objects.h
+++ b/src/pack-objects.h
@@ -15,6 +15,7 @@
#include "oidmap.h"
#include "netops.h"
#include "zstream.h"
+#include "pool.h"
#include "git2/oid.h"
#include "git2/pack.h"
@@ -50,6 +51,12 @@ typedef struct git_pobject {
filled:1;
} git_pobject;
+typedef struct {
+ git_oid id;
+ unsigned int uninteresting:1,
+ seen:1;
+} git_walk_object;
+
struct git_packbuilder {
git_repository *repo; /* associated repository */
git_odb *odb; /* associated object database */
@@ -66,6 +73,9 @@ struct git_packbuilder {
git_oidmap *object_ix;
+ git_oidmap *walk_objects;
+ git_pool object_pool;
+
git_oid pack_oid; /* hash of written pack */
/* synchronization objects */