summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-05-02 05:54:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-02 05:54:22 (GMT)
commitcbd800ba7901dc89ce00930334eebf2b6b84cefb (patch)
tree3b1a8f14241432b1576a95be8bb4fdee5ae15b69
parent95a31cc5b32c5ab787e419124826ac202a00b7f5 (diff)
parent9a8b6a0a9d4de3d9c1005b872b9b57a213d3e9f8 (diff)
downloadgit-cbd800ba7901dc89ce00930334eebf2b6b84cefb.zip
git-cbd800ba7901dc89ce00930334eebf2b6b84cefb.tar.gz
git-cbd800ba7901dc89ce00930334eebf2b6b84cefb.tar.bz2
Merge branch 'jc/pack'
-rw-r--r--pack-objects.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pack-objects.c b/pack-objects.c
index c0acc46..6604338 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1032,12 +1032,6 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
max_depth -= cur_entry->delta_limit;
}
- size = cur_entry->size;
- oldsize = old_entry->size;
- sizediff = oldsize > size ? oldsize - size : size - oldsize;
-
- if (size < 50)
- return -1;
if (old_entry->depth >= max_depth)
return 0;
@@ -1048,9 +1042,12 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
* more space-efficient (deletes don't have to say _what_ they
* delete).
*/
+ size = cur_entry->size;
max_size = size / 2 - 20;
if (cur_entry->delta)
max_size = cur_entry->delta_size-1;
+ oldsize = old_entry->size;
+ sizediff = oldsize < size ? size - oldsize : 0;
if (sizediff >= max_size)
return 0;
delta_buf = diff_delta(old->data, oldsize,
@@ -1109,6 +1106,9 @@ static void find_deltas(struct object_entry **list, int window, int depth)
*/
continue;
+ if (entry->size < 50)
+ continue;
+
free(n->data);
n->entry = entry;
n->data = read_sha1_file(entry->sha1, type, &size);