]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewdiff: escape '{' and '}' for regexp
authorEric Wong <e@80x24.org>
Fri, 28 May 2021 00:07:53 +0000 (00:07 +0000)
committerEric Wong <e@80x24.org>
Fri, 28 May 2021 03:46:34 +0000 (03:46 +0000)
Perl 5 doesn't warn on this, yet, but it warns on unescaped
'(' and ')' nowadays, so it's conceivable Perl could start
warning on this in the future.  So future-proof our code and
reduce reader confusion.

lib/PublicInbox/ViewDiff.pm

index 05acc2420a85ec81b8ad821303ecf8c168ca9dd6..f492b6971981706753480f8bc36554f7cd43b120 100644 (file)
@@ -77,7 +77,7 @@ sub anchor0 ($$$$) {
        # which works well in practice. If projects put "=>", or trailing
        # spaces in filenames, oh well :P
        $fn =~ s/$DIFFSTAT_COMMENT//;
-       $fn =~ s/{(?:.+) => (.+)}/$1/ or $fn =~ s/.* => (.+)/$1/;
+       $fn =~ s/\{(?:.+) => (.+)\}/$1/ or $fn =~ s/.* => (.+)/$1/;
        $fn = git_unquote($fn);
 
        # long filenames will require us to check in anchor1()