Skip to content

Commit 12f0967

Browse files
jrngitster
authored andcommitted
userdiff/perl: match full line of POD headers
The builtin perl userdiff driver is not greedy enough about catching POD header lines. Capture the whole line, so instead of just declaring that we are in some "@@ =head1" section, diff/grep output can explain that the enclosing section is about "@@ =head1 OPTIONS". Reported-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f12c66b commit 12f0967

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

t/t4018-diff-funcname.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ test_expect_success 'perl pattern is not distracted by sub within POD' '
125125
test_expect_funcname "=head" perl
126126
'
127127

128+
test_expect_success 'perl pattern gets full line of POD header' '
129+
test_expect_funcname "=head1 SYNOPSIS\$" perl
130+
'
131+
128132
test_expect_success 'custom pattern' '
129133
test_config diff.java.funcname "!static
130134
!String

userdiff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PATTERNS("perl",
6363
"^package .*;\n"
6464
"^sub .* \\{\n"
6565
"^[A-Z]+ \\{\n" /* BEGIN, END, ... */
66-
"^=head[0-9] ", /* POD */
66+
"^=head[0-9] .*", /* POD */
6767
/* -- */
6868
"[[:alpha:]_'][[:alnum:]_']*"
6969
"|0[xb]?[0-9a-fA-F_]*"

0 commit comments

Comments
 (0)