Please make git-am handle \r\n-damaged patches

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Please make git-am handle \r\n-damaged patches

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:47:08

In a serious case of craniorectal immersion, the Thunderbird developers
have started using \r\n line endings on saved emails:

https://bugzilla.mozilla.org/show_bug.cgi?id=503271
https://bugzilla.mozilla.org/show_bug.cgi?id=507530

It would be nice if git-am could handle this case automatically.

	-hpa

Re: Please make git-am handle \r\n-damaged patches

From: Alex Riesen <hidden>
Date: 2016-06-15 22:47:08

On Mon, Aug 3, 2009 at 21:08, H. Peter Anvin[off-list ref] wrote:
In a serious case of craniorectal immersion, the Thunderbird developers
have started using \r\n line endings on saved emails:

https://bugzilla.mozilla.org/show_bug.cgi?id=503271
https://bugzilla.mozilla.org/show_bug.cgi?id=507530

It would be nice if git-am could handle this case automatically.
Maybe it is as simple as that (not tested yet,
and sent through gmail, so please be careful):
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index ad5f6b5..02c1c92 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -58,6 +58,8 @@ int read_line_with_nul(char *buf, int size, FILE *in)
 		if (c == '\n' || len + 1 >= size)
 			break;
 	}
+	if (len && buf[len - 1] == '\r')
+		--len;
 	buf[len] = '\0';

 	return len;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help