From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Wong <normalperson@yhbt.net>, git@vger.kernel.org
Subject: Re: [PATCH 2/3] git config --get-colorbool
Date: Thu, 6 Dec 2007 00:30:59 -0500 [thread overview]
Message-ID: <20071206053059.GF5499@coredump.intra.peff.net> (raw)
In-Reply-To: <1196906706-11170-2-git-send-email-gitster@pobox.com>
[Eric Wong cc'd because of git-svn relevance]
On Wed, Dec 05, 2007 at 06:05:04PM -0800, Junio C Hamano wrote:
> This adds an option to help scripts find out color settings from
> the configuration file.
>
> git config --get-colorbool color.diff
>
> inspects color.diff variable, and exits with status 0 (i.e. success) if
> color is to be used. It exits with status 1 otherwise.
There is no way to differentiate between "do not use color" and "no
value found". This makes it impossible to use this to implement the
required "try color.diff, fallback to diff.color" behavior.
We could simply make it
git config --get-colorbool diff
which would check both (and when diff.color support is finally dropped,
just remove it from there).
git-svn should probably be moved to this interface (it still has the
color.diff == true means "always" behavior), but it can't be until the
fallback behavior is implemented.
Also, your patch doesn't seem to implement the color.pager/pager.color
behavior, either (which is probably not important for git-add -i, but is
used by git-svn).
Anyway, below is a totally untested (I don't even have svn installed,
but it passes perl -wc!) patch for git-svn to use the new "true means
auto" behavior for color.diff. It would be nice to replace this with
a working --get-colorbool, but we should at least unify the behavior
before v1.5.4.
-Peff
---
diff --git a/git-svn.perl b/git-svn.perl
index 9f884eb..71f6e93 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3979,7 +3979,12 @@ sub log_use_color {
$dc = `git-config --get $dcvar`;
}
chomp($dc);
- if ($dc eq 'auto') {
+ return 0 if $dc eq 'never';
+ return 1 if $dc eq 'always';
+ if ($dc ne 'auto') {
+ chomp($dc = `git-config --bool --get $dcvar`);
+ }
+ if ($dc eq 'auto' || $dc eq 'true') {
my $pc;
$pc = `git-config --get color.pager`;
if ($pc eq '') {
@@ -3998,10 +4003,7 @@ sub log_use_color {
}
return 0;
}
- return 0 if $dc eq 'never';
- return 1 if $dc eq 'always';
- chomp($dc = `git-config --bool --get $dcvar`);
- return ($dc eq 'true');
+ return 0;
}
sub git_svn_log_cmd {
next prev parent reply other threads:[~2007-12-06 5:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-05 10:59 [PATCH] Color support for "git-add -i" Junio C Hamano
2007-12-05 12:21 ` Johannes Sixt
2007-12-05 13:52 ` Wincent Colaiuta
2007-12-05 19:46 ` Junio C Hamano
2007-12-06 2:05 ` [PATCH 1/3] Documentation: color.* = true means "auto" Junio C Hamano
2007-12-06 2:05 ` [PATCH 2/3] git config --get-colorbool Junio C Hamano
2007-12-06 2:05 ` [PATCH 3/3] Color support for "git-add -i" Junio C Hamano
2007-12-06 2:05 ` [PATCH 0/3] Reroll colorized "git add -i" Junio C Hamano
2007-12-06 5:40 ` [PATCH 3/3] Color support for "git-add -i" Jeff King
2007-12-06 19:59 ` Wincent Colaiuta
2007-12-06 20:18 ` Junio C Hamano
2007-12-07 12:34 ` Wincent Colaiuta
2007-12-06 5:30 ` Jeff King [this message]
2007-12-06 5:35 ` [PATCH 2/3] git config --get-colorbool Jeff King
2007-12-06 6:12 ` Junio C Hamano
2007-12-06 6:17 ` Jeff King
2007-12-06 7:38 ` Eric Wong
2007-12-05 13:55 ` [PATCH] Color support for "git-add -i" Wincent Colaiuta
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=20071206053059.GF5499@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=normalperson@yhbt.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).