From: Eric Sunshine <sunshine@sunshineco.com>
To: Lance Ward <ljward10@gmail.com>
Cc: "Lance Ward via GitGitGadget" <gitgitgadget@gmail.com>,
"Git List" <git@vger.kernel.org>,
"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH] status: learn --color for piping colored output
Date: Tue, 2 Feb 2021 23:46:34 -0500 [thread overview]
Message-ID: <CAPig+cSSU1P68dBomjRkO4jUqUnu+0ri5-3y0-H228-qONwhyw@mail.gmail.com> (raw)
In-Reply-To: <CACPHW2VBEu=02HFhyrDes=6KceLtHzGDqBJVf2qAnD2s1f8VAg@mail.gmail.com>
On Mon, Feb 1, 2021 at 11:09 PM Lance Ward <ljward10@gmail.com> wrote:
> On Sun, Jan 31, 2021 at 5:09 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > I think the approach I suggested of patching those wt-status.c functions
> > to use:
> > rev.diffopt.use_color = s->use_color;
> > would fix this inconsistency, wouldn't it?
>
> I've made the change you requested and it resolves the issue.
> It also fixed the inconsistency I mentioned. I only needed
> to modify wt_longstatus_print_verbose to resolve the issue
> since it is the only status path that had an issue with the
> git status command.
Okay, makes sense. As long as you insert the assignment somewhere
above the special case:
if (s->fp != stdout) {
rev.diffopt.use_color = 0;
wt_status_add_cut_line(s->fp);
}
then it should work correctly, I would think. However, it might be
easier for people to grok the logic overall if you incorporate it into
that conditional, perhaps like this:
if (s->fp != stdout) {
rev.diffopt.use_color = 0;
wt_status_add_cut_line(s->fp);
} else {
rev.diffopt.use_color = s->use_color;
}
Or this:
if (s->fp == stdout) {
rev.diffopt.use_color = s->use_color;
else {
rev.diffopt.use_color = 0;
wt_status_add_cut_line(s->fp);
}
It's subjective, of course, so use your best judgment.
> > In fact, I can envision this patch being re-rolled as a two-patch
> > series which (1) patches the wt-status.c functions to do
> > `rev.diffopt.use_color = s->use_color` which should make
> > `color.status` imply `color.diff`, and (2) adds a --color option to
> > `git status` which sets `wt_status.use_color` (which would then be
> > automatically inherited by the diff machinery due to the first patch).
>
> Right now as it stands my patch resolves both of these, but
> if you'd like to make it two separate patches that would be fine.
The reason I was thinking of splitting these changes into two patches
is that they have different purposes. You'd sell the first patch as a
straight up bug fix, and it's easier to formulate a proper "sales
spiel" for that if it's not blurred with other changes. (This may be
important because it could be slightly controversial if other people
don't consider the behavior as being buggy.) The second patch would be
an easy sell as a straightforward and simple enhancement. Another
reason for splitting them into two patches is that doing so would make
it easier to revert the bug-fix patch separately if it turns out that
there are unforeseen negative side-effects.
Having said that, a well-crafted commit message may very well make it
easy to sell the change(s) as a single patch. Again, use your best
judgment.
next prev parent reply other threads:[~2021-02-03 4:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-30 15:45 [PATCH] status: learn --color for piping colored output Lance Ward via GitGitGadget
2021-01-31 7:31 ` Eric Sunshine
2021-01-31 18:49 ` Lance Ward
2021-01-31 23:09 ` Eric Sunshine
2021-02-02 4:09 ` Lance Ward
2021-02-03 4:46 ` Eric Sunshine [this message]
2021-02-03 21:08 ` Lance Ward
2021-02-05 6:23 ` Eric Sunshine
-- strict thread matches above, loose matches on Subject: below --
2021-02-03 21:40 Lance Ward via GitGitGadget
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPig+cSSU1P68dBomjRkO4jUqUnu+0ri5-3y0-H228-qONwhyw@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=ljward10@gmail.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).