From: Nicolas Pitre Date: Fri, 30 Jun 2006 03:44:52 GMT Subject: [PATCH] consider previous pack undeltified object state only when reusing delta data Message-ID: In-Reply-To: <7vwtazobkw.fsf@assigned-by-dhcp.cox.net> Without this there would never be a chance to improve packing for previously undeltified objects. Signed-off-by: Nicolas Pitre --- On Thu, 29 Jun 2006, Junio C Hamano wrote: > Nicolas Pitre writes: > > > On Thu, 29 Jun 2006, Linus Torvalds wrote: > > > >> > >> > >> On Thu, 29 Jun 2006, Nicolas Pitre wrote: > >> > > >> > On Thu, 29 Jun 2006, Linus Torvalds wrote: > >> > > >> > > Instead of having a separate cache, wouldn't it be much better to just > >> > > take the hint from the previous pack-file? > >> > > >> > DOH! ;-) > >> > >> Btw, I think this could do with a flag to turn it on/off (but probably > >> default to on). > > > > I think it should simply be coupled with the --no-reuse-delta flag. > > I agree that makes sense. So here it is. diff --git a/pack-objects.c b/pack-objects.c index 6e17676..47da33b 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -989,9 +989,10 @@ static int try_delta(struct unpacked *tr /* * We do not bother to try a delta that we discarded - * on an earlier try. + * on an earlier try, but only when reusing delta data. */ - if (trg_entry->in_pack && trg_entry->in_pack == src_entry->in_pack) + if (!no_reuse_delta && trg_entry->in_pack && + trg_entry->in_pack == src_entry->in_pack) return 0; /*