From: Davide Libenzi <davidel@xmailserver.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Morten Welinder <mwelinder@gmail.com>,
Junio C Hamano <junkio@cox.net>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Use a *real* built-in diff generator
Date: Sat, 25 Mar 2006 21:33:36 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603252130190.12437@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0603251040190.15714@g5.osdl.org>
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
next prev parent reply other threads:[~2006-03-26 5:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-25 4:13 Use a *real* built-in diff generator Linus Torvalds
2006-03-25 6:54 ` Junio C Hamano
2006-03-25 7:39 ` Junio C Hamano
2006-03-25 17:28 ` Linus Torvalds
2006-03-25 9:03 ` Davide Libenzi
2006-03-25 9:35 ` Marco Costalba
2006-03-25 12:56 ` Alex Riesen
2006-03-25 16:09 ` Linus Torvalds
2006-03-25 13:44 ` Morten Welinder
2006-03-25 15:36 ` Linus Torvalds
2006-03-25 15:56 ` Linus Torvalds
2006-03-25 18:14 ` Davide Libenzi
2006-03-25 18:39 ` Linus Torvalds
2006-03-26 4:11 ` Davide Libenzi
2006-03-26 11:09 ` Ralf Baechle
2006-03-26 18:20 ` Petr Baudis
2006-03-25 18:48 ` Linus Torvalds
2006-03-26 5:33 ` Davide Libenzi [this message]
2006-03-25 19:52 ` Junio C Hamano
2006-03-25 20:17 ` Junio C Hamano
2006-03-25 20:48 ` Linus Torvalds
2006-03-25 21:06 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0603252130190.12437@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=mwelinder@gmail.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).