From: Eric Wong Date: Mon, 4 Feb 2019 11:40:13 +0000 (+0000) Subject: viewdiff: group path match to not be confused by "/dev/null" X-Git-Tag: v1.2.0~371 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=3a2f21e2cb2e054be70505fae522a71627391610 viewdiff: group path match to not be confused by "/dev/null" Leaving out parentheses caused transitions to state="del" or state="add" to be misidentified. cf. https://public-inbox.org/meta/20190204105454.GG10587@szeder.dev/ Reported-by: SZEDER Gábor --- diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index c818203b..a773e385 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -190,8 +190,8 @@ sub flush_diff ($$$) { $$dst .= ''; $state = DSTATE_CTX; $$dst .= to_html($linkify, $s); - } elsif ($s =~ m!^--- $PATH_A! || - $s =~ m!^\+{3} $PATH_B!) { + } elsif ($s =~ m!^--- (?:$PATH_A)! || + $s =~ m!^\+{3} (?:$PATH_B)!) { # color only (no oid link) if missing dctx->{oid_*} $state <= DSTATE_STAT and to_state($dst, $state, DSTATE_HEAD);