summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-17 01:52:32 -0700
committerJunio C Hamano <gitster@pobox.com>2008-10-17 01:52:32 -0700
commit46dc1b0e332612aa32c139007fa33f4b429de9d1 (patch)
tree86e934ac60e69c03c44a9d59eab6e400c16efb5f /xdiff-interface.c
parent84ed4c5d117d72f02cc918e413b9861a9d2846d7 (diff)
parent8ed0a740dd42bd0724aebed6e3b07c4ea2a2d5e8 (diff)
downloadgit-46dc1b0e332612aa32c139007fa33f4b429de9d1.tar.gz
Merge branch 'maint'
* maint: t1301-shared-repo.sh: don't let a default ACL interfere with the test git-check-attr(1): add output and example sections xdiff-interface.c: strip newline (and cr) from line before pattern matching t4018-diff-funcname: demonstrate end of line funcname matching flaw t4018-diff-funcname: rework negated last expression test Typo "does not exists" when git remote update remote. remote.c: correct the check for a leading '/' in a remote name Add testcase to ensure merging an early part of a branch is done properly Conflicts: t/t7600-merge.sh
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index f3f6db3297..49e06af710 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -207,6 +207,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)) {