From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: george.w.king@gmail.com, git <git@vger.kernel.org>
Subject: Re: Difficulty with parsing colorized diff output
Date: Tue, 11 Dec 2018 05:17:42 -0500 [thread overview]
Message-ID: <20181211101742.GE31588@sigill.intra.peff.net> (raw)
In-Reply-To: <CAGZ79kbd=2_eHdbVYwmNoAYupwnP3YDn6nT0m=v1CL0AkWXk=Q@mail.gmail.com>
On Mon, Dec 10, 2018 at 07:26:46PM -0800, Stefan Beller wrote:
> > Context lines do have both. It's just that the default color for context
> > lines is empty. ;)
>
> The content itself can contain color codes.
>
> Instead of unconditionally resetting each line, we could parse each
> content line to determine if we actually have to reset the colors.
Good point. I don't recall that being the motivation back when this
behavior started, but it's a nice side effect (and the more recent line
you mentioned in emit_line_0 certainly is doing it intentionally).
That doesn't cover _other_ terminal codes, which could also make for
confusing output, but I do think color codes are somewhat special. We
generally send patches through "less -R", which will pass through the
colors but show escaped versions of other codes.
> Another idea would be to allow Git to output its output
> as if it was run through test_decode_color, slightly related:
> https://public-inbox.org/git/20180804015317.182683-8-sbeller@google.com/
> i.e. we'd markup the output instead of coloring it.
Yeah, I think in the most general form, the problem is that colorizing
(including whitespace highlighting) loses information within a single
line. It would be nice to have a machine-readable format that represents
all the various annotations (like whitespace and coloring moved bits)
that Git computes.
-Peff
next prev parent reply other threads:[~2018-12-11 10:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-08 0:09 Difficulty with parsing colorized diff output George King
2018-12-08 7:16 ` Jeff King
2018-12-11 3:26 ` Stefan Beller
2018-12-11 10:17 ` Jeff King [this message]
2018-12-11 14:47 ` George King
2018-12-11 16:28 ` Ævar Arnfjörð Bjarmason
2018-12-11 16:41 ` George King
2018-12-11 18:55 ` George King
2018-12-12 13:52 ` Jeff King
2018-12-12 12:49 ` Jeff King
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181211101742.GE31588@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=george.w.king@gmail.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).