Thread (24 messages) flat view 24 messages, 8 authors, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:08

Possibly related (same subject, not in this thread)

Alex Riesen [off-list ref] writes:
Maybe it is as simple as that (not tested yet,
and sent through gmail, so please be careful):
I thought about this approach, but it made me worried about a case where
an otherwise sane piece of e-mail has \r at the end of one line as the
real payload.  But as long as we are talking about a text e-mail (and we
are talking about mailsplit here and a binary payload with a CTE applied
counts as text), I think we can safely use an approach like this.
quoted hunk
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