Re: [PATCH 08/13] prevent try_delta from using objects not in pack
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 5, 2007, 23:04 UTC
- Message-ID
- <7v8xd6mni1.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <56b7f5510704051535ya98e86eu7f786f118c4fe229@mail.gmail.com>
"Dana How" <danahow@gmail.com> writes:
Show 21 quoted lines
> Subject: [PATCH 08/13] prevent try_delta from using objects not in pack > > --- > builtin-pack-objects.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c > index 9eb5fd6..37b0150 100644 > --- a/builtin-pack-objects.c > +++ b/builtin-pack-objects.c > @@ -1251,6 +1251,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, > if (trg_entry->type != src_entry->type) > return -1; > > + /* Don't try deltas involving already/non written objects */ > + if (trg_entry->no_write || src_entry->no_write) > + return -1; > + > /* We do not compute delta to *create* objects we are not > * going to pack. > */
I think trg_entry->no_write case should return -1 (meaning: doesn't delta with this source, nor any other sources you would throw at try_delta()), but shouldn't src_entry->no_write case return 0 (meaning: does not delta with this source, but do not give up -- other source candidate you have might be usable)?