From: Junio C Hamano <junkio@cox.net>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Subject: Re: [PATCH] Allow subcommand.color and color.subcommand color configuration
Date: Wed, 13 Dec 2006 14:16:44 -0800 [thread overview]
Message-ID: <7vodq7e90z.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <200612130913.28917.andyparkins@gmail.com> (Andy Parkins's message of "Wed, 13 Dec 2006 09:13:28 +0000")
Andy Parkins <andyparkins@gmail.com> writes:
> While adding colour to the branch command it was pointed out that a
> config option like "branch.color" conflicts with the pre-existing
> "branch.something" namespace used for specifying default merge urls and
> branches. The suggested solution was to flip the order of the
> components to "color.branch", which I did for colourising branch.
> ...
> Unfortunately git-svn reads "diff.color" and "pager.color"; which I
> don't like to change unilaterally.
I think doing the same makes sense. Something like this?
-- >8 --
git-svn: allow both diff.color and color.diff
The list concensus is to group color related configuration under
"color.*" so let's be consistent.
Inspired by Andy Parkins's patch to do the same for diff/log
family.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-svn.perl b/git-svn.perl
index ec92b44..2893e3b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -925,19 +925,38 @@ sub cmt_showable {
sub log_use_color {
return 1 if $_color;
- my $dc;
- chomp($dc = `git-repo-config --get diff.color`);
+ my ($dc, $dcvar);
+ $dcvar = 'color.diff'
+ $dc = `git-repo-config --get $dcvar`;
+ if ($dc eq '') {
+ # nothing at all; fallback to "diff.color"
+ $dcvar = 'diff.color';
+ $dc = `git-repo-config --get $dcvar`;
+ }
+ chomp($dc);
if ($dc eq 'auto') {
- if (-t *STDOUT || (defined $_pager &&
- `git-repo-config --bool --get pager.color` !~ /^false/)) {
+ my $pc;
+ $pc = `git-repo-config --get color.pager`;
+ if ($pc eq '') {
+ # does not have it -- fallback to pager.color
+ $pc = `git-repo-config --bool --get pager.color`;
+ }
+ else {
+ $pc = `git-repo-config --bool --get color.pager`;
+ if ($?) {
+ $pc = 'false';
+ }
+ }
+ chomp($pc);
+ if (-t *STDOUT || (defined $_pager && $pc eq 'true') {
return ($ENV{TERM} && $ENV{TERM} ne 'dumb');
}
return 0;
}
return 0 if $dc eq 'never';
return 1 if $dc eq 'always';
- chomp($dc = `git-repo-config --bool --get diff.color`);
- $dc eq 'true';
+ chomp($dc = `git-repo-config --bool --get $dcvar`);
+ return ($dc eq 'true');
}
sub git_svn_log_cmd {
next prev parent reply other threads:[~2006-12-13 22:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-13 9:13 [PATCH] Allow subcommand.color and color.subcommand color configuration Andy Parkins
2006-12-13 22:16 ` Junio C Hamano [this message]
2006-12-13 22:52 ` Andy Parkins
2006-12-13 23:42 ` Eric Wong
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=7vodq7e90z.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
--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.
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).