From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Will Palmer <wmpalmer@gmail.com>, git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v2 1/3] pretty: add conditional %C?colorname placeholders
Date: Sun, 25 Apr 2010 23:26:42 -0400 [thread overview]
Message-ID: <20100426032642.GA14421@coredump.intra.peff.net> (raw)
In-Reply-To: <20100426021347.GA29669@progeny.tock>
On Sun, Apr 25, 2010 at 09:13:47PM -0500, Jonathan Nieder wrote:
> This is nice because in certain situations (e.g. different background
> colors), the default colors might not be suitable. As an example of
> this, the ‘commit ’ line of ‘git log’ output uses color.diff.commit.
>
> So it would be nice to be able to use %C(diff.commit) and
> automatically use the right color, if color is enabled.
FWIW, I like this idea very much. And it would be a bit more natural for
%C(diff.commit) to respect diff.color, whereas we could perhaps keep
%Cred as "always on" for backwards compatibility.
However:
> Why not make %C always check? I can understand that it would be
> annoying when first trying to use %C. On the other hand, it would be
I am a little nervous that we would be breaking scripts that pipe the
colorized output for later display to the user. Right now doing
something like[1]:
log=`git log --format=%Cred%h`
test "x$log" != x && echo "foo: $log"
colorizes, but we would be breaking it. And for new values like
%C(diff.commit), we are not breaking anything (because it is a new
syntax), but a script like the one above may want to convert, and there
is no way to say "respect the color _config_, but don't respect
isatty(1)". Saying "--color" doesn't work, because it overrides the
color config. We can cheat a little with GIT_PAGER_IN_USE, but that will
have funny interactions with pager.color.
[1] Yes, I know this snippet is contrived, but it seems within the realm
of possibility. git-add--interactive reads the diff output in both
regular and color forms, though it takes some care to look at the user's
config and decide whether to show the color.
-Peff
next prev parent reply other threads:[~2010-04-26 3:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 21:56 [PATCH v2 0/3] pretty: format aliases Will Palmer
2010-04-25 21:56 ` [PATCH v2 1/3] pretty: add conditional %C?colorname placeholders Will Palmer
2010-04-25 21:56 ` [PATCH v2 2/3] pretty: make %H/%h dependent on --abbrev[-commit] Will Palmer
2010-04-25 21:56 ` [PATCH v2 3/3] pretty: add aliases for pretty formats Will Palmer
2010-04-26 7:25 ` Jonathan Nieder
2010-04-26 8:15 ` Will Palmer
2010-04-26 22:11 ` Will Palmer
2010-04-26 3:11 ` [PATCH v2 2/3] pretty: make %H/%h dependent on --abbrev[-commit] Jonathan Nieder
2010-04-26 3:31 ` Jeff King
2010-04-26 3:38 ` Jonathan Nieder
2010-04-26 3:41 ` Jonathan Nieder
2010-04-26 3:45 ` Jeff King
2010-04-26 3:42 ` Jeff King
2010-04-26 7:47 ` Will Palmer
2010-04-26 9:53 ` Jonathan Nieder
2010-04-26 9:58 ` [PATCH 1/4] t4201 (shortlog): guard setup with test_expect_success Jonathan Nieder
2010-04-26 9:59 ` [PATCH 2/4] t4201 (shortlog): Test output format with multiple authors Jonathan Nieder
2010-04-26 9:59 ` [PATCH 3/4] shortlog: Document and test --format option Jonathan Nieder
2010-04-26 10:00 ` [PATCH 4/4] pretty: Respect --abbrev option Jonathan Nieder
2010-04-26 10:13 ` [PATCH v2 2/3] pretty: make %H/%h dependent on --abbrev[-commit] Will Palmer
2010-04-26 10:19 ` Jonathan Nieder
2010-04-26 10:23 ` Will Palmer
2010-04-26 10:28 ` Jonathan Nieder
2010-04-26 2:13 ` [PATCH v2 1/3] pretty: add conditional %C?colorname placeholders Jonathan Nieder
2010-04-26 3:26 ` Jeff King [this message]
2010-04-26 4:14 ` Jonathan Nieder
2010-04-26 14:28 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100426032642.GA14421@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=wmpalmer@gmail.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).