Re: Delitifier broken (Re: diff-core segfault)

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-12-13 10:31:42
On Mon, 12 Dec 2005, Junio C Hamano wrote:
> Nicolas Pitre <nico@cam.org> writes:
> >
> > I would say involving an empty blob with deltas _is_ the bug in the 
> > first place.  Please don't let that happen.

I agree with Nicolas.

> Not all use of delta is to produce a pack.  An empty->empty
> delta is a valid two byte \0\0 sequence, and I do not see any
> reason to forbid it.  Although using such delta to represent
> anything in a pack does *not* make any sense as you say, it
> makes other callers simpler if they do not have to check if
> from_len and to_len are empty before calling the delta code.

And you don't need to.

Do what pack-objects.c does: just call "diff_delta()" and check the result 
for NULL. If the result is NULL, then you have to do some special code, 
because that means that it's a full create or a full delete (or it's an 
unchanged empty file). Regardless, it really _is_ a special case, and it 
would be silly to generate a delta for it.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Dec 13 10:33:18 2005

This archive was generated by hypermail 2.1.8 : 2005-12-13 10:33:25 EST