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>
Brandon Casey committed
Oct 15, 2008 at 19:58 UTC
b19d288b4d440c76348b519d06a4ed7b62c93611
1 file changed
+6
t/t4018-diff-funcname.sh
+6
@@ -69,6 +69,12 @@ test_expect_success 'last regexp must not be negated' '
69
grep "fatal: Last expression must not be negated:"
70
'
71
72
+test_expect_failure 'pattern which matches to end of line' '
73
+ git config diff.java.funcname "Beer$" &&
74
+ git diff --no-index Beer.java Beer-correct.java |
75
+ grep "^@@.*@@ Beer"
76
+'
77
+
78
test_expect_success 'alternation in pattern' '
79
git config diff.java.xfuncname "^[ ]*((public|static).*)$" &&
80
git diff --no-index Beer.java Beer-correct.java |