From: Tor Arvid Lund <torarvid@gmail.com>
To: git@vger.kernel.org
Subject: BUG?: git-apply sometimes says "corrupt patch" when adding single lines
Date: Wed, 18 Aug 2010 01:27:27 +0200 [thread overview]
Message-ID: <AANLkTineHiG9vCpbJzJ2x9CFjZ7LQeExs7cN5YhoZhft@mail.gmail.com> (raw)
Hi.
I often use git-gui when staging commits, and I noticed that if the
file I'm working with has a:
\ No newline at end of file
... as the last line of the diff, and I try to "Stage lines for
commit", then git-gui (or really git-apply, as I understand it) says
that I have a "corrupt patch at line <so-and-so>".
I don't really know the git-gui code or the git C code well, but it
seems that I got around the error with this small patch:
diff --git a/builtin/apply.c b/builtin/apply.c
index 12ef9ea..124791f 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1335,6 +1335,8 @@ static int parse_fragment(char *line, unsigned long size,
* l10n of "\ No newline..." is at least that long.
*/
case '\\':
+ if (newlines == oldlines == 1)
+ newlines = oldlines = 0;
if (len < 12 || memcmp(line, "\\ ", 2))
return -1;
break;
Is this a bug? Or is it maybe git-gui that sends something wrong to
git-apply? I don't know... :-/
(I'm using msysGit on Windows, if that matters)
-Tor Arvid-
next reply other threads:[~2010-08-17 23:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 23:27 Tor Arvid Lund [this message]
2010-08-17 23:43 ` BUG?: git-apply sometimes says "corrupt patch" when adding single lines Jonathan Nieder
2010-08-18 1:37 ` Tor Arvid Lund
2010-08-18 7:29 ` Johannes Sixt
2010-08-18 9:15 ` Tor Arvid Lund
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=AANLkTineHiG9vCpbJzJ2x9CFjZ7LQeExs7cN5YhoZhft@mail.gmail.com \
--to=torarvid@gmail.com \
--cc=git@vger.kernel.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).