]> asedeno.scripts.mit.edu Git - git.git/blobdiff - xdiff-interface.c
Merge git://repo.or.cz/git-gui
[git.git] / xdiff-interface.c
index 70794c71fcbf198c7425a49789a912369fba28ad..e8ef46d10dc53a1ee1781d07685984734bc3160f 100644 (file)
@@ -254,6 +254,16 @@ static long ff_regexp(const char *line, long len,
 
        line_buffer = xstrndup(line, len); /* make NUL terminated */
 
+       /* Exclude terminating newline (and cr) from matching */
+       if (len > 0 && line[len-1] == '\n') {
+               if (len > 1 && line[len-2] == '\r')
+                       len -= 2;
+               else
+                       len--;
+       }
+
+       line_buffer = xstrndup(line, len); /* make NUL terminated */
+
        for (i = 0; i < regs->nr; i++) {
                struct ff_reg *reg = regs->array + i;
                if (!regexec(&reg->re, line_buffer, 2, pmatch, 0)) {