summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-05-06 19:20:33 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-05-09 09:40:29 +0200
commit2acdf4b854bf55ba2630c7342d09b136d919d6ad (patch)
tree2848d19b198d10ecb3c1a75c215dd61ec08f2079 /src/pack.h
parentae0817393c0aaff5c4b085c46ed11acc0ab64198 (diff)
downloadlibgit2-2acdf4b854bf55ba2630c7342d09b136d919d6ad.tar.gz
pack: unpack using a loop
We currently make use of recursive function calls to unpack an object, resolving the deltas as we come back down the chain. This means that we have unbounded stack growth as we look up objects in a pack. This is now done in two steps: first we figure out what the dependency chain is by looking up the delta bases until we reach a non-delta object, pushing the information we need onto a stack and then we pop from that stack and apply the deltas until there are no more left. This version of the code does not make use of the delta base cache so it is slower than what's in the mainline. A later commit will reintroduce it.
Diffstat (limited to 'src/pack.h')
-rw-r--r--src/pack.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index 58f81e2f0..a2ea3849f 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -17,6 +17,7 @@
#include "mwindow.h"
#include "odb.h"
#include "oidmap.h"
+#include "array.h"
#define GIT_PACK_FILE_MODE 0444
@@ -60,6 +61,14 @@ typedef struct git_pack_cache_entry {
git_rawobj raw;
} git_pack_cache_entry;
+struct pack_chain_elem {
+ git_off_t offset;
+ size_t size;
+ git_otype type;
+};
+
+typedef git_array_t(struct pack_chain_elem) git_dependency_chain;
+
#include "offmap.h"
GIT__USE_OFFMAP;