mirror of
https://github.com/git/git.git
synced 2024-11-06 01:03:02 +01:00
Merge branch 'jc/pack' into next
* jc/pack: pack-objects: simplify "thin" pack.
This commit is contained in:
commit
9c3592cf3c
1 changed files with 11 additions and 27 deletions
|
@ -32,9 +32,6 @@ struct object_entry {
|
||||||
* be used as the base objectto delta huge
|
* be used as the base objectto delta huge
|
||||||
* objects against.
|
* objects against.
|
||||||
*/
|
*/
|
||||||
int based_on_preferred; /* current delta candidate is a preferred
|
|
||||||
* one, or delta against a preferred one.
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -824,8 +821,6 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
|
||||||
{
|
{
|
||||||
struct object_entry *cur_entry = cur->entry;
|
struct object_entry *cur_entry = cur->entry;
|
||||||
struct object_entry *old_entry = old->entry;
|
struct object_entry *old_entry = old->entry;
|
||||||
int old_preferred = (old_entry->preferred_base ||
|
|
||||||
old_entry->based_on_preferred);
|
|
||||||
unsigned long size, oldsize, delta_size, sizediff;
|
unsigned long size, oldsize, delta_size, sizediff;
|
||||||
long max_size;
|
long max_size;
|
||||||
void *delta_buf;
|
void *delta_buf;
|
||||||
|
@ -867,27 +862,8 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
|
||||||
* delete).
|
* delete).
|
||||||
*/
|
*/
|
||||||
max_size = size / 2 - 20;
|
max_size = size / 2 - 20;
|
||||||
if (cur_entry->delta) {
|
if (cur_entry->delta)
|
||||||
if (cur_entry->based_on_preferred) {
|
|
||||||
if (old_preferred)
|
|
||||||
max_size = cur_entry->delta_size-1;
|
max_size = cur_entry->delta_size-1;
|
||||||
else
|
|
||||||
/* trying with non-preferred one when we
|
|
||||||
* already have a delta based on preferred
|
|
||||||
* one is pointless.
|
|
||||||
*/
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (!old_preferred)
|
|
||||||
max_size = cur_entry->delta_size-1;
|
|
||||||
else
|
|
||||||
/* otherwise... even if delta with a
|
|
||||||
* preferred one produces a bigger result than
|
|
||||||
* what we currently have, which is based on a
|
|
||||||
* non-preferred one, it is OK.
|
|
||||||
*/
|
|
||||||
;
|
|
||||||
}
|
|
||||||
if (sizediff >= max_size)
|
if (sizediff >= max_size)
|
||||||
return -1;
|
return -1;
|
||||||
delta_buf = diff_delta(old->data, oldsize,
|
delta_buf = diff_delta(old->data, oldsize,
|
||||||
|
@ -897,7 +873,6 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
|
||||||
cur_entry->delta = old_entry;
|
cur_entry->delta = old_entry;
|
||||||
cur_entry->delta_size = delta_size;
|
cur_entry->delta_size = delta_size;
|
||||||
cur_entry->depth = old_entry->depth + 1;
|
cur_entry->depth = old_entry->depth + 1;
|
||||||
cur_entry->based_on_preferred = old_preferred;
|
|
||||||
free(delta_buf);
|
free(delta_buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -966,6 +941,15 @@ static void find_deltas(struct object_entry **list, int window, int depth)
|
||||||
if (try_delta(n, m, depth) < 0)
|
if (try_delta(n, m, depth) < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
/* if we made n a delta, and if n is already at max
|
||||||
|
* depth, leaving it in the window is pointless. we
|
||||||
|
* should evict it first.
|
||||||
|
* ... in theory only; somehow this makes things worse.
|
||||||
|
*/
|
||||||
|
if (entry->delta && depth <= entry->depth)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
idx++;
|
idx++;
|
||||||
if (idx >= window)
|
if (idx >= window)
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
Loading…
Reference in a new issue