Re: Use a *real* built-in diff generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 25 Mar 2006, Linus Torvalds wrote:

Btw, git-apply does it, and it's actually quite simple: the code to handle
the "\ No newline" case is literally just this:

               /*
                * "plen" is how much of the line we should use for
                * the actual patch data. Normally we just remove the
                * first character on the line, but if the line is
                * followed by "\ No newline", then we also remove the
                * last one (which is the newline, of course).
                */
               plen = len-1;
               if (len < size && patch[len] == '\\')
                       plen--;

if we just remove the last '\n' on a line, if the _next_ line starts with
a '\\' (so the git-apply code actually depends on knowing that the patch
text is dense, and that it's also padded out so that you can look one byte
past the end of the diff and it won't be a '\\').

I don't know how well that fits into xpatch (I never looked at the patch
side, since I already had my own ;), but my point being that handling this
special case _can_ be very simple if the data structures are just set up
for it.

Yeah, should be a pretty trivial fix in the xpatch parsing code. Thanks for remembering me the missing-eol issue, that fell forgotten somewhere in my todo list :D



- Davide


-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]