Skip to content

Commit 2a7f6ff

Browse files
committed
Merge branch 'pw/maint-p4-rcs-expansion-newline' into maint
"git p4" used to try expanding malformed "$keyword$" that spans across multiple lines. * pw/maint-p4-rcs-expansion-newline: git p4: RCS expansion should not span newlines
2 parents 4047fec + 6b2bf41 commit 2a7f6ff

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

git-p4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def p4_keywords_regexp_for_type(base, type_mods):
227227
pattern = r"""
228228
\$ # Starts with a dollar, followed by...
229229
(%s) # one of the keywords, followed by...
230-
(:[^$]+)? # possibly an old expansion, followed by...
230+
(:[^$\n]+)? # possibly an old expansion, followed by...
231231
\$ # another dollar
232232
""" % kwords
233233
return pattern

t/t9810-git-p4-rcs.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,25 @@ test_expect_success 'cleanup after failure' '
155155
)
156156
'
157157

158+
# perl $File:: bug check
159+
test_expect_success 'ktext expansion should not expand multi-line $File::' '
160+
(
161+
cd "$cli" &&
162+
cat >lv.pm <<-\EOF
163+
my $wanted = sub { my $f = $File::Find::name;
164+
if ( -f && $f =~ /foo/ ) {
165+
EOF
166+
p4 add -t ktext lv.pm &&
167+
p4 submit -d "lv.pm"
168+
) &&
169+
test_when_finished cleanup_git &&
170+
git p4 clone --dest="$git" //depot &&
171+
(
172+
cd "$git" &&
173+
test_cmp "$cli/lv.pm" lv.pm
174+
)
175+
'
176+
158177
#
159178
# Do not scrub anything but +k or +ko files. Sneak a change into
160179
# the cli file so that submit will get a conflict. Make sure that

0 commit comments

Comments
 (0)