git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* BUG?: git-apply sometimes says "corrupt patch" when adding single lines
@ 2010-08-17 23:27 Tor Arvid Lund
  2010-08-17 23:43 ` Jonathan Nieder
  2010-08-18  7:29 ` Johannes Sixt
  0 siblings, 2 replies; 5+ messages in thread
From: Tor Arvid Lund @ 2010-08-17 23:27 UTC (permalink / raw)
  To: git

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-

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-18  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17 23:27 BUG?: git-apply sometimes says "corrupt patch" when adding single lines Tor Arvid Lund
2010-08-17 23:43 ` 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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).