summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2007-12-11 01:28:42 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-12-11 00:42:07 -0800
commitcd459e3ffa1b85f3a33c52967b1a7dff43bda29e (patch)
treeadd6d684c9d1ca973b17efe843651b225865796c
parentSupport GIT_PAGER_IN_USE environment variable (diff)
downloadtgif-cd459e3ffa1b85f3a33c52967b1a7dff43bda29e.tar.xz
git-svn: get color config from --get-colorbool
git-config recently learned a --get-colorbool option. By using it, we will get the same color=auto behavior that other git commands have. Specifically, this fixes the case where "color.diff = true" meant "always" in git-svn, but "auto" in other programs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-svn.perl35
1 files changed, 2 insertions, 33 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 9f884eb213..1c42c558c4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3969,39 +3969,7 @@ sub cmt_showable {
}
sub log_use_color {
- return 1 if $color;
- my ($dc, $dcvar);
- $dcvar = 'color.diff';
- $dc = `git-config --get $dcvar`;
- if ($dc eq '') {
- # nothing at all; fallback to "diff.color"
- $dcvar = 'diff.color';
- $dc = `git-config --get $dcvar`;
- }
- chomp($dc);
- if ($dc eq 'auto') {
- my $pc;
- $pc = `git-config --get color.pager`;
- if ($pc eq '') {
- # does not have it -- fallback to pager.color
- $pc = `git-config --bool --get pager.color`;
- }
- else {
- $pc = `git-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-config --bool --get $dcvar`);
- return ($dc eq 'true');
+ return $color || Git->repository->get_colorbool('color.diff');
}
sub git_svn_log_cmd {
@@ -4060,6 +4028,7 @@ sub config_pager {
} elsif (length $pager == 0 || $pager eq 'cat') {
$pager = undef;
}
+ $ENV{GIT_PAGER_IN_USE} = defined($pager);
}
sub run_pager {