X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fpack-objects.c;h=0f2e7b8f5cb26910679c39550d59ef23353a278f;hb=8c80ff362f1f4e586a37fba8e6dc83eee67aa2b5;hp=96c1680976fc653a1cd7a9dd81a567885a5b0050;hpb=c53d1e49f9b87cbfb7e53b17cd935e8c54469d6b;p=git.git diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 96c168097..0f2e7b8f5 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1434,11 +1434,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;