mercurial/diffhelpers.c
changeset 10129 900ccbd79ef7
parent 5483 ec2cc1dadbf7
child 10146 9c59cdafcc24
--- a/mercurial/diffhelpers.c	Wed Dec 23 19:31:48 2009 +0100
+++ b/mercurial/diffhelpers.c	Wed Dec 23 19:31:48 2009 +0100
@@ -22,6 +22,9 @@
 	PyObject *s = PyList_GET_ITEM(hunk, hunksz-1);
 	char *l = PyString_AS_STRING(s);
 	int sz = PyString_GET_SIZE(s);
+	if (sz > 1 && l[sz-2] == '\r')
+	        /* tolerate CRLF in last line */
+	        sz -= 1;
 	int alen = PyList_Size(a);
 	int blen = PyList_Size(b);
 	char c = l[0];