summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Brandon Casey <drafnel@gmail.com>2008-10-15 19:58:50 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-10-16 08:31:56 -0700
commitb19d288b4d440c76348b519d06a4ed7b62c93611 (patch)
tree98e943295a273e3271faf395f69d1be8e61a7650 /t
parentt4018-diff-funcname: rework negated last expression test (diff)
downloadtgif-b19d288b4d440c76348b519d06a4ed7b62c93611.tar.xz
t4018-diff-funcname: demonstrate end of line funcname matching flaw
Since the newline is not removed from lines before pattern matching, a pattern cannot match to the end of the line using the '$' operator without using an additional operator which will indirectly match the '\n' character. Introduce a test which should pass, but which does not due to this flaw. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4018-diff-funcname.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 72076eca80..40a805a866 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -69,6 +69,12 @@ test_expect_success 'last regexp must not be negated' '
grep "fatal: Last expression must not be negated:"
'
+test_expect_failure 'pattern which matches to end of line' '
+ git config diff.java.funcname "Beer$" &&
+ git diff --no-index Beer.java Beer-correct.java |
+ grep "^@@.*@@ Beer"
+'
+
test_expect_success 'alternation in pattern' '
git config diff.java.xfuncname "^[ ]*((public|static).*)$" &&
git diff --no-index Beer.java Beer-correct.java |