提交 b19d288b 编写于 作者: B Brandon Casey 提交者: Junio C Hamano

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: NBrandon Casey <drafnel@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 16b26725
......@@ -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 |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册