path: root/pack-objects.c
diff options
authorJunio C Hamano <>2005-06-26 11:29:18 (GMT)
committerLinus Torvalds <>2005-06-26 14:33:23 (GMT)
commit8ee378a0f00a56cbffedee21fdbba30870d84436 (patch)
tree78600eeaac28aa694b72a70d524b5d0f9839f15c /pack-objects.c
parentd116a45a9a505d9a58cdd1c79193f759316c440d (diff)
[PATCH] Finish initial cut of git-pack-object/git-unpack-object pair.
This finishes the initial round of git-pack-object / git-unpack-object pair. They are now good enough to be used as a transport medium: - Fix delta direction in pack-objects; the original was computing delta to create the base object from the object to be squashed, which was quite unfriendly for unpacker ;-). - Add a script to test the very basics. - Implement unpacker for both regular and deltified objects. Signed-off-by: Junio C Hamano <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'pack-objects.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/pack-objects.c b/pack-objects.c
index 9d87a64..3900df3 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -82,7 +82,8 @@ static void *delta_against(void *buf, unsigned long size, struct object_entry *e
if (!otherbuf)
die("unable to read %s", sha1_to_hex(entry->delta->sha1));
- delta_buf = diff_delta(buf, size, otherbuf, othersize, &delta_size, ~0UL);
+ delta_buf = diff_delta(otherbuf, othersize,
+ buf, size, &delta_size, ~0UL);
if (!delta_buf || delta_size != entry->delta_size)
die("delta size changed");
@@ -318,7 +319,8 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
max_size = size / 2 - 20;
if (cur_entry->delta)
max_size = cur_entry->delta_size-1;
- delta_buf = diff_delta(cur->data, size, old->data, oldsize, &delta_size, max_size);
+ delta_buf = diff_delta(old->data, oldsize,
+ cur->data, size, &delta_size, max_size);
if (!delta_buf)
return 0;
cur_entry->delta = old_entry;