Since we sort objects by type, hash, preferredness and then
size, after we have a delta against preferred base, there is no
point trying a delta with non-preferred base. This seems to
save expensive calls to diff-delta and it also seems to save the
output space as well.
Signed-off-by: Junio C Hamano <junkio@cox.net>
raw | patch | inline | side by side (parent: b19696c )
struct packed_git *p;
unsigned int found_offset = 0;
struct packed_git *found_pack = NULL;
struct packed_git *p;
unsigned int found_offset = 0;
struct packed_git *found_pack = NULL;
if (!exclude) {
for (p = packed_git; p; p = p->next) {
if (!exclude) {
for (p = packed_git; p; p = p->next) {
die("internal error in object hashing.");
object_ix[-1 - ix] = idx + 1;
}
die("internal error in object hashing.");
object_ix[-1 - ix] = idx + 1;
}
already_added:
if (exclude)
already_added:
if (exclude)
entry->in_pack_offset = found_offset;
}
}
entry->in_pack_offset = found_offset;
}
}
}
static void add_pbase_tree(struct tree_desc *tree)
}
static void add_pbase_tree(struct tree_desc *tree)
continue;
if (sha1_object_info(sha1, type, &size))
continue;
continue;
if (sha1_object_info(sha1, type, &size))
continue;
- add_object_entry(sha1, name, 1);
+
+ if (!add_object_entry(sha1, name, 1))
+ continue;
+
if (!strcmp(type, "tree")) {
struct tree_desc sub;
void *elem;
if (!strcmp(type, "tree")) {
struct tree_desc sub;
void *elem;
tree.buf = elem;
if (!tree.buf)
return;
tree.buf = elem;
if (!tree.buf)
return;
- add_object_entry(sha1, "", 1);
- add_pbase_tree(&tree);
+ if (add_object_entry(sha1, "", 1))
+ add_pbase_tree(&tree);
* already have a delta based on preferred
* one is pointless.
*/
* already have a delta based on preferred
* one is pointless.
*/
}
else if (!old_preferred)
max_size = cur_entry->delta_size-1;
}
else if (!old_preferred)
max_size = cur_entry->delta_size-1;