user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <>
To: "SZEDER Gábor" <>
Subject: [PATCH] viewdiff: group path match to not be confused by "/dev/null"
Date: Mon, 4 Feb 2019 11:49:22 +0000
Message-ID: <20190204114922.GA5127@dcvr> (raw)
In-Reply-To: <>

SZEDER Gábor <> wrote:
> Hi,
> First of all, thanks you very much for adding syntax highlighting for
> patch emails, it's fantastic!

You're welcome, but it's clearly a work-in-progress :)

> However, I noticed that a patch I recently sent to the Git mailing
> list got bogus syntax highlighting, as the added line is colored as
> removed:
> Perhaps the '>' shell redirection operator causes troubles?  I clicked
> around in the list archives, and sure enough found other occurrance of
> this bug, that also seems to suggest that a '>' might be problematic
> only when it's on the first added line:

Not the '>', it was actually "/dev/null" :x

The following seems to work:

Subject: [PATCH] viewdiff: group path match to not be confused by "/dev/null"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Leaving out parentheses caused transitions to state="del" or
state="add" to be misidentified.


Reported-by: SZEDER Gábor <>
 lib/PublicInbox/ | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/ b/lib/PublicInbox/
index c818203..a773e38 100644
--- a/lib/PublicInbox/
+++ b/lib/PublicInbox/
@@ -190,8 +190,8 @@ sub flush_diff ($$$) {
 			$$dst .= '</span>';
 			$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);

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 10:54 syntax highlighting bug with lines containing '>' SZEDER Gábor
2019-02-04 11:49 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190204114922.GA5127@dcvr \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:

AGPL code for this site: git clone