summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-01-12 23:31:46 -0800
committerJunio C Hamano <gitster@pobox.com>2012-01-12 23:31:46 -0800
commit5a6a9394814273e88124a5576c0be6d37a1262cc (patch)
treef1fdb053daf114e415b369b026fd566781d83050 /builtin/pack-objects.c
parent113e828d3893f31ef72dd8287e95da9fa2287110 (diff)
parent8f83acf77cd14567dfdeff0e15f2da086109df70 (diff)
downloadgit-5a6a9394814273e88124a5576c0be6d37a1262cc.tar.gz
Merge branch 'maint-1.7.7' into maint
* maint-1.7.7: Update draft release notes to 1.7.7.6 Update draft release notes to 1.7.6.6 thin-pack: try harder to use preferred base objects as base
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index b1895aaaa1..ef703dfeb6 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1456,11 +1456,16 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
return -1;
/*
- * We do not bother to try a delta that we discarded
- * on an earlier try, but only when reusing delta data.
+ * We do not bother to try a delta that we discarded on an
+ * earlier try, but only when reusing delta data. Note that
+ * src_entry that is marked as the preferred_base should always
+ * be considered, as even if we produce a suboptimal delta against
+ * it, we will still save the transfer cost, as we already know
+ * the other side has it and we won't send src_entry at all.
*/
if (reuse_delta && trg_entry->in_pack &&
trg_entry->in_pack == src_entry->in_pack &&
+ !src_entry->preferred_base &&
trg_entry->in_pack_type != OBJ_REF_DELTA &&
trg_entry->in_pack_type != OBJ_OFS_DELTA)
return 0;