From: Eric Wong Date: Fri, 28 May 2021 00:07:53 +0000 (+0000) Subject: viewdiff: escape '{' and '}' for regexp X-Git-Tag: v1.7.0~635 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7957be919f9fcf2c1dd9a2c0c1cc1e775de1ff52;p=public-inbox.git viewdiff: escape '{' and '}' for regexp 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. --- diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 05acc242..f492b697 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -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()