git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fix color.pager = false with "git diff"
Date: Thu, 21 Oct 2010 21:49:07 -0400	[thread overview]
Message-ID: <20101022014907.GA30532@sigill.intra.peff.net> (raw)
In-Reply-To: <7vzku7rwcv.fsf@alter.siamese.dyndns.org>

On Thu, Oct 21, 2010 at 03:53:36PM -0700, Junio C Hamano wrote:

> > Original discussion here:
> >
> >   http://thread.gmane.org/gmane.comp.version-control.git/89599
> >
> > I have mixed feelings on this one. It's kind of a hack. A more elegant
> > solution would be totally rewriting the color code to check for the
> > pager at first output.
> >
> > In favor of this patch:
> >
> >   1. It fixes a real bug.
> >
> >   2. Perfect is the enemy of the good, and I don't care enough about
> >      this case to refactor the color code.
> 
> Hmm, with "[color] pager = false", what should
> 
>     $ git diff --color
> 
> do?

Ugh. It should definitely turn color on, which my patch breaks. And
there's currently no way to know at that point in the code whether the
COLOR_DIFF bit came from --color or from the config.

So we would need to start keeping that information through the
callchain, or we need to refactor the color code to push the color
decision until later (probably first use). The latter is the right way,
I think, but it's going to take some surgery.

Either way, let's scrap my patch. The bug it introduces is just as bad
as the bug it fixes.

Thanks for noticing.

-Peff

      reply	other threads:[~2010-10-22  1:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 15:02 [PATCH] fix color.pager = false with "git diff" Jeff King
2010-10-21 19:02 ` Jonathan Nieder
2010-10-21 22:53 ` Junio C Hamano
2010-10-22  1:49   ` Jeff King [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:
  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=20101022014907.GA30532@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).