Merge branch 'jk/ui-color-always-to-auto-maint' (early part) into jk/ref-filter-colors-fix-maint
* 'jk/ui-color-always-to-auto-maint' (early part): color: make "always" the same as "auto" in config provide --color option for all ref-filter users t3205: use --color instead of color.branch=always t3203: drop "always" color test t6006: drop "always" color config tests t7502: use diff.noprefix for --verbose test t7508: use test_terminal for color output t3701: use test-terminal to collect color output t4015: prefer --color to -c color.diff=always test-terminal: set TERM=vt100
This commit is contained in:
commit
433d62fea9
@ -1052,10 +1052,10 @@ clean.requireForce::
|
|||||||
|
|
||||||
color.branch::
|
color.branch::
|
||||||
A boolean to enable/disable color in the output of
|
A boolean to enable/disable color in the output of
|
||||||
linkgit:git-branch[1]. May be set to `always`,
|
linkgit:git-branch[1]. May be set to `false` (or `never`) to
|
||||||
`false` (or `never`) or `auto` (or `true`), in which case colors are used
|
disable color entirely, `auto` (or `true` or `always`) in which
|
||||||
only when the output is to a terminal. If unset, then the
|
case colors are used only when the output is to a terminal. If
|
||||||
value of `color.ui` is used (`auto` by default).
|
unset, then the value of `color.ui` is used (`auto` by default).
|
||||||
|
|
||||||
color.branch.<slot>::
|
color.branch.<slot>::
|
||||||
Use customized color for branch coloration. `<slot>` is one of
|
Use customized color for branch coloration. `<slot>` is one of
|
||||||
@ -1066,12 +1066,11 @@ color.branch.<slot>::
|
|||||||
|
|
||||||
color.diff::
|
color.diff::
|
||||||
Whether to use ANSI escape sequences to add color to patches.
|
Whether to use ANSI escape sequences to add color to patches.
|
||||||
If this is set to `always`, linkgit:git-diff[1],
|
If this is set to `true` or `auto`, linkgit:git-diff[1],
|
||||||
linkgit:git-log[1], and linkgit:git-show[1] will use color
|
linkgit:git-log[1], and linkgit:git-show[1] will use color
|
||||||
for all patches. If it is set to `true` or `auto`, those
|
when output is to the terminal. The value `always` is a
|
||||||
commands will only use color when output is to the terminal.
|
historical synonym for `auto`. If unset, then the value of
|
||||||
If unset, then the value of `color.ui` is used (`auto` by
|
`color.ui` is used (`auto` by default).
|
||||||
default).
|
|
||||||
+
|
+
|
||||||
This does not affect linkgit:git-format-patch[1] or the
|
This does not affect linkgit:git-format-patch[1] or the
|
||||||
'git-diff-{asterisk}' plumbing commands. Can be overridden on the
|
'git-diff-{asterisk}' plumbing commands. Can be overridden on the
|
||||||
@ -1124,12 +1123,12 @@ color.grep.<slot>::
|
|||||||
--
|
--
|
||||||
|
|
||||||
color.interactive::
|
color.interactive::
|
||||||
When set to `always`, always use colors for interactive prompts
|
When set to `true` or `auto`, use colors for interactive prompts
|
||||||
and displays (such as those used by "git-add --interactive" and
|
and displays (such as those used by "git-add --interactive" and
|
||||||
"git-clean --interactive"). When false (or `never`), never.
|
"git-clean --interactive") when the output is to the terminal.
|
||||||
When set to `true` or `auto`, use colors only when the output is
|
When false (or `never`), never show colors. The value `always`
|
||||||
to the terminal. If unset, then the value of `color.ui` is
|
is a historical synonym for `auto`. If unset, then the value of
|
||||||
used (`auto` by default).
|
`color.ui` is used (`auto` by default).
|
||||||
|
|
||||||
color.interactive.<slot>::
|
color.interactive.<slot>::
|
||||||
Use customized color for 'git add --interactive' and 'git clean
|
Use customized color for 'git add --interactive' and 'git clean
|
||||||
@ -1176,10 +1175,10 @@ color.ui::
|
|||||||
configuration to set a default for the `--color` option. Set it
|
configuration to set a default for the `--color` option. Set it
|
||||||
to `false` or `never` if you prefer Git commands not to use
|
to `false` or `never` if you prefer Git commands not to use
|
||||||
color unless enabled explicitly with some other configuration
|
color unless enabled explicitly with some other configuration
|
||||||
or the `--color` option. Set it to `always` if you want all
|
or the `--color` option. Set it to `true` or `auto` to enable
|
||||||
output not intended for machine consumption to use color, to
|
color when output is written to the terminal (this is also the
|
||||||
`true` or `auto` (this is the default since Git 1.8.4) if you
|
default since Git 1.8.4). The value `always` is a historical
|
||||||
want such output to use color when written to the terminal.
|
synonym for `auto`.
|
||||||
|
|
||||||
column.ui::
|
column.ui::
|
||||||
Specify whether supported commands should output in columns.
|
Specify whether supported commands should output in columns.
|
||||||
|
@ -56,6 +56,11 @@ OPTIONS
|
|||||||
literally, in the latter case matching completely or from the
|
literally, in the latter case matching completely or from the
|
||||||
beginning up to a slash.
|
beginning up to a slash.
|
||||||
|
|
||||||
|
--color[=<when>]:
|
||||||
|
Respect any colors specified in the `--format` option. The
|
||||||
|
`<when>` field must be one of `always`, `never`, or `auto` (if
|
||||||
|
`<when>` is absent, behave as if `always` was given).
|
||||||
|
|
||||||
--shell::
|
--shell::
|
||||||
--perl::
|
--perl::
|
||||||
--python::
|
--python::
|
||||||
|
@ -115,6 +115,11 @@ options for details.
|
|||||||
variable if it exists, or lexicographic order otherwise. See
|
variable if it exists, or lexicographic order otherwise. See
|
||||||
linkgit:git-config[1].
|
linkgit:git-config[1].
|
||||||
|
|
||||||
|
--color[=<when>]:
|
||||||
|
Respect any colors specified in the `--format` option. The
|
||||||
|
`<when>` field must be one of `always`, `never`, or `auto` (if
|
||||||
|
`<when>` is absent, behave as if `always` was given).
|
||||||
|
|
||||||
-i::
|
-i::
|
||||||
--ignore-case::
|
--ignore-case::
|
||||||
Sorting and filtering tags are case insensitive.
|
Sorting and filtering tags are case insensitive.
|
||||||
|
@ -36,6 +36,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
|
|||||||
OPT_GROUP(""),
|
OPT_GROUP(""),
|
||||||
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
|
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
|
||||||
OPT_STRING( 0 , "format", &format.format, N_("format"), N_("format to use for the output")),
|
OPT_STRING( 0 , "format", &format.format, N_("format"), N_("format to use for the output")),
|
||||||
|
OPT__COLOR(&format.use_color, N_("respect format colors")),
|
||||||
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
||||||
N_("field name to sort on"), &parse_opt_ref_sorting),
|
N_("field name to sort on"), &parse_opt_ref_sorting),
|
||||||
OPT_CALLBACK(0, "points-at", &filter.points_at,
|
OPT_CALLBACK(0, "points-at", &filter.points_at,
|
||||||
|
@ -411,6 +411,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
|
|||||||
},
|
},
|
||||||
OPT_STRING( 0 , "format", &format.format, N_("format"),
|
OPT_STRING( 0 , "format", &format.format, N_("format"),
|
||||||
N_("format to use for the output")),
|
N_("format to use for the output")),
|
||||||
|
OPT__COLOR(&format.use_color, N_("respect format colors")),
|
||||||
OPT_BOOL('i', "ignore-case", &icase, N_("sorting and filtering are case insensitive")),
|
OPT_BOOL('i', "ignore-case", &icase, N_("sorting and filtering are case insensitive")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
2
color.c
2
color.c
@ -308,7 +308,7 @@ int git_config_colorbool(const char *var, const char *value)
|
|||||||
if (!strcasecmp(value, "never"))
|
if (!strcasecmp(value, "never"))
|
||||||
return 0;
|
return 0;
|
||||||
if (!strcasecmp(value, "always"))
|
if (!strcasecmp(value, "always"))
|
||||||
return 1;
|
return var ? GIT_COLOR_AUTO : 1;
|
||||||
if (!strcasecmp(value, "auto"))
|
if (!strcasecmp(value, "auto"))
|
||||||
return GIT_COLOR_AUTO;
|
return GIT_COLOR_AUTO;
|
||||||
}
|
}
|
||||||
|
@ -253,13 +253,7 @@ test_expect_success '%(color) omitted without tty' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success TTY '%(color) present with tty' '
|
test_expect_success TTY '%(color) present with tty' '
|
||||||
test_terminal env TERM=vt100 git branch $color_args >actual.raw &&
|
test_terminal git branch $color_args >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
|
||||||
test_cmp expect.color actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'color.branch=always overrides auto-color' '
|
|
||||||
git -c color.branch=always branch $color_args >actual.raw &&
|
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expect.color actual
|
test_cmp expect.color actual
|
||||||
'
|
'
|
||||||
|
@ -12,7 +12,6 @@ test_expect_success 'set up some sample branches' '
|
|||||||
# choose non-default colors to make sure config
|
# choose non-default colors to make sure config
|
||||||
# is taking effect
|
# is taking effect
|
||||||
test_expect_success 'set up some color config' '
|
test_expect_success 'set up some color config' '
|
||||||
git config color.branch always &&
|
|
||||||
git config color.branch.local blue &&
|
git config color.branch.local blue &&
|
||||||
git config color.branch.remote yellow &&
|
git config color.branch.remote yellow &&
|
||||||
git config color.branch.current cyan
|
git config color.branch.current cyan
|
||||||
@ -24,7 +23,7 @@ test_expect_success 'regular output shows colors' '
|
|||||||
<BLUE>other<RESET>
|
<BLUE>other<RESET>
|
||||||
<YELLOW>remotes/origin/master<RESET>
|
<YELLOW>remotes/origin/master<RESET>
|
||||||
EOF
|
EOF
|
||||||
git branch -a >actual.raw &&
|
git branch --color -a >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
@ -36,7 +35,7 @@ test_expect_success 'verbose output shows colors' '
|
|||||||
<BLUE>other <RESET> $oid foo
|
<BLUE>other <RESET> $oid foo
|
||||||
<YELLOW>remotes/origin/master<RESET> $oid foo
|
<YELLOW>remotes/origin/master<RESET> $oid foo
|
||||||
EOF
|
EOF
|
||||||
git branch -v -a >actual.raw &&
|
git branch --color -v -a >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
test_description='add -i basic tests'
|
test_description='add -i basic tests'
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||||
|
|
||||||
if ! test_have_prereq PERL
|
if ! test_have_prereq PERL
|
||||||
then
|
then
|
||||||
@ -380,14 +381,11 @@ test_expect_success 'patch mode ignores unmerged entries' '
|
|||||||
test_cmp expected diff
|
test_cmp expected diff
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'diffs can be colorized' '
|
test_expect_success TTY 'diffs can be colorized' '
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
|
|
||||||
# force color even though the test script has no terminal
|
|
||||||
test_config color.ui always &&
|
|
||||||
|
|
||||||
echo content >test &&
|
echo content >test &&
|
||||||
printf y | git add -p >output 2>&1 &&
|
printf y | test_terminal git add -p >output 2>&1 &&
|
||||||
|
|
||||||
# We do not want to depend on the exact coloring scheme
|
# We do not want to depend on the exact coloring scheme
|
||||||
# git uses for diffs, so just check that we saw some kind of color.
|
# git uses for diffs, so just check that we saw some kind of color.
|
||||||
@ -485,4 +483,14 @@ test_expect_success 'hunk-editing handles custom comment char' '
|
|||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'add -p works even with color.ui=always' '
|
||||||
|
git reset --hard &&
|
||||||
|
echo change >>file &&
|
||||||
|
test_config color.ui always &&
|
||||||
|
echo y | git add -p &&
|
||||||
|
echo file >expect &&
|
||||||
|
git diff --cached --name-only >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -821,7 +821,7 @@ test_expect_success 'diff that introduces a line with only tabs' '
|
|||||||
echo "test" >x &&
|
echo "test" >x &&
|
||||||
git commit -m "initial" x &&
|
git commit -m "initial" x &&
|
||||||
echo "{NTN}" | tr "NT" "\n\t" >>x &&
|
echo "{NTN}" | tr "NT" "\n\t" >>x &&
|
||||||
git -c color.diff=always diff | test_decode_color >current &&
|
git diff --color | test_decode_color >current &&
|
||||||
|
|
||||||
cat >expected <<-\EOF &&
|
cat >expected <<-\EOF &&
|
||||||
<BOLD>diff --git a/x b/x<RESET>
|
<BOLD>diff --git a/x b/x<RESET>
|
||||||
@ -851,7 +851,7 @@ test_expect_success 'diff that introduces and removes ws breakages' '
|
|||||||
echo "2. and a new line "
|
echo "2. and a new line "
|
||||||
} >x &&
|
} >x &&
|
||||||
|
|
||||||
git -c color.diff=always diff |
|
git diff --color |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
|
|
||||||
cat >expected <<-\EOF &&
|
cat >expected <<-\EOF &&
|
||||||
@ -923,15 +923,15 @@ test_expect_success 'ws-error-highlight test setup' '
|
|||||||
|
|
||||||
test_expect_success 'test --ws-error-highlight option' '
|
test_expect_success 'test --ws-error-highlight option' '
|
||||||
|
|
||||||
git -c color.diff=always diff --ws-error-highlight=default,old |
|
git diff --color --ws-error-highlight=default,old |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.default-old current &&
|
test_cmp expect.default-old current &&
|
||||||
|
|
||||||
git -c color.diff=always diff --ws-error-highlight=all |
|
git diff --color --ws-error-highlight=all |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.all current &&
|
test_cmp expect.all current &&
|
||||||
|
|
||||||
git -c color.diff=always diff --ws-error-highlight=none |
|
git diff --color --ws-error-highlight=none |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.none current
|
test_cmp expect.none current
|
||||||
|
|
||||||
@ -939,15 +939,15 @@ test_expect_success 'test --ws-error-highlight option' '
|
|||||||
|
|
||||||
test_expect_success 'test diff.wsErrorHighlight config' '
|
test_expect_success 'test diff.wsErrorHighlight config' '
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=default,old diff |
|
git -c diff.wsErrorHighlight=default,old diff --color |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.default-old current &&
|
test_cmp expect.default-old current &&
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=all diff |
|
git -c diff.wsErrorHighlight=all diff --color |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.all current &&
|
test_cmp expect.all current &&
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=none diff |
|
git -c diff.wsErrorHighlight=none diff --color |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.none current
|
test_cmp expect.none current
|
||||||
|
|
||||||
@ -955,18 +955,18 @@ test_expect_success 'test diff.wsErrorHighlight config' '
|
|||||||
|
|
||||||
test_expect_success 'option overrides diff.wsErrorHighlight' '
|
test_expect_success 'option overrides diff.wsErrorHighlight' '
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=none \
|
git -c diff.wsErrorHighlight=none \
|
||||||
diff --ws-error-highlight=default,old |
|
diff --color --ws-error-highlight=default,old |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.default-old current &&
|
test_cmp expect.default-old current &&
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=default \
|
git -c diff.wsErrorHighlight=default \
|
||||||
diff --ws-error-highlight=all |
|
diff --color --ws-error-highlight=all |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.all current &&
|
test_cmp expect.all current &&
|
||||||
|
|
||||||
git -c color.diff=always -c diff.wsErrorHighlight=all \
|
git -c diff.wsErrorHighlight=all \
|
||||||
diff --ws-error-highlight=none |
|
diff --color --ws-error-highlight=none |
|
||||||
test_decode_color >current &&
|
test_decode_color >current &&
|
||||||
test_cmp expect.none current
|
test_cmp expect.none current
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ test_expect_success 'log.decorate config parsing' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success TTY 'log output on a TTY' '
|
test_expect_success TTY 'log output on a TTY' '
|
||||||
git log --oneline --decorate >expect.short &&
|
git log --color --oneline --decorate >expect.short &&
|
||||||
|
|
||||||
test_terminal git log --oneline >actual &&
|
test_terminal git log --oneline >actual &&
|
||||||
test_cmp expect.short actual
|
test_cmp expect.short actual
|
||||||
|
@ -208,29 +208,13 @@ do
|
|||||||
has_no_color actual
|
has_no_color actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "$desc enables colors for color.diff" '
|
|
||||||
git -c color.diff=always log --format=$color -1 >actual &&
|
|
||||||
has_color actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success "$desc enables colors for color.ui" '
|
|
||||||
git -c color.ui=always log --format=$color -1 >actual &&
|
|
||||||
has_color actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success "$desc respects --color" '
|
test_expect_success "$desc respects --color" '
|
||||||
git log --format=$color -1 --color >actual &&
|
git log --format=$color -1 --color >actual &&
|
||||||
has_color actual
|
has_color actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "$desc respects --no-color" '
|
|
||||||
git -c color.ui=always log --format=$color -1 --no-color >actual &&
|
|
||||||
has_no_color actual
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success TTY "$desc respects --color=auto (stdout is tty)" '
|
test_expect_success TTY "$desc respects --color=auto (stdout is tty)" '
|
||||||
test_terminal env TERM=vt100 \
|
test_terminal git log --format=$color -1 --color=auto >actual &&
|
||||||
git log --format=$color -1 --color=auto >actual &&
|
|
||||||
has_color actual
|
has_color actual
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -241,6 +225,11 @@ do
|
|||||||
has_no_color actual
|
has_no_color actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success TTY "$desc respects --no-color" '
|
||||||
|
test_terminal git log --format=$color -1 --no-color >actual &&
|
||||||
|
has_no_color actual
|
||||||
|
'
|
||||||
done
|
done
|
||||||
|
|
||||||
test_expect_success '%C(always,...) enables color even without tty' '
|
test_expect_success '%C(always,...) enables color even without tty' '
|
||||||
|
@ -425,8 +425,7 @@ test_expect_success 'set up color tests' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success TTY '%(color) shows color with a tty' '
|
test_expect_success TTY '%(color) shows color with a tty' '
|
||||||
test_terminal env TERM=vt100 \
|
test_terminal git for-each-ref --format="$color_format" >actual.raw &&
|
||||||
git for-each-ref --format="$color_format" >actual.raw &&
|
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expected.color actual
|
test_cmp expected.color actual
|
||||||
'
|
'
|
||||||
@ -436,8 +435,8 @@ test_expect_success '%(color) does not show color without tty' '
|
|||||||
test_cmp expected.bare actual
|
test_cmp expected.bare actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'color.ui=always can override tty check' '
|
test_expect_success '--color can override tty check' '
|
||||||
git -c color.ui=always for-each-ref --format="$color_format" >actual.raw &&
|
git for-each-ref --color --format="$color_format" >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expected.color actual
|
test_cmp expected.color actual
|
||||||
'
|
'
|
||||||
|
@ -1914,13 +1914,13 @@ test_expect_success '%(color) omitted without tty' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success TTY '%(color) present with tty' '
|
test_expect_success TTY '%(color) present with tty' '
|
||||||
test_terminal env TERM=vt100 git tag $color_args >actual.raw &&
|
test_terminal git tag $color_args >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expect.color actual
|
test_cmp expect.color actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'color.ui=always overrides auto-color' '
|
test_expect_success '--color overrides auto-color' '
|
||||||
git -c color.ui=always tag $color_args >actual.raw &&
|
git tag --color $color_args >actual.raw &&
|
||||||
test_decode_color <actual.raw >actual &&
|
test_decode_color <actual.raw >actual &&
|
||||||
test_cmp expect.color actual
|
test_cmp expect.color actual
|
||||||
'
|
'
|
||||||
|
@ -239,7 +239,7 @@ test_expect_success 'no color when stdout is a regular file' '
|
|||||||
test_expect_success TTY 'color when writing to a pager' '
|
test_expect_success TTY 'color when writing to a pager' '
|
||||||
rm -f paginated.out &&
|
rm -f paginated.out &&
|
||||||
test_config color.ui auto &&
|
test_config color.ui auto &&
|
||||||
test_terminal env TERM=vt100 git log &&
|
test_terminal git log &&
|
||||||
colorful paginated.out
|
colorful paginated.out
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ test_expect_success TTY 'colors are suppressed by color.pager' '
|
|||||||
rm -f paginated.out &&
|
rm -f paginated.out &&
|
||||||
test_config color.ui auto &&
|
test_config color.ui auto &&
|
||||||
test_config color.pager false &&
|
test_config color.pager false &&
|
||||||
test_terminal env TERM=vt100 git log &&
|
test_terminal git log &&
|
||||||
! colorful paginated.out
|
! colorful paginated.out
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ test_expect_success 'color when writing to a file intended for a pager' '
|
|||||||
test_expect_success TTY 'colors are sent to pager for external commands' '
|
test_expect_success TTY 'colors are sent to pager for external commands' '
|
||||||
test_config alias.externallog "!git log" &&
|
test_config alias.externallog "!git log" &&
|
||||||
test_config color.ui auto &&
|
test_config color.ui auto &&
|
||||||
test_terminal env TERM=vt100 git -p externallog &&
|
test_terminal git -p externallog &&
|
||||||
colorful paginated.out
|
colorful paginated.out
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -171,9 +171,9 @@ test_expect_success 'verbose' '
|
|||||||
|
|
||||||
test_expect_success 'verbose respects diff config' '
|
test_expect_success 'verbose respects diff config' '
|
||||||
|
|
||||||
test_config color.diff always &&
|
test_config diff.noprefix true &&
|
||||||
git status -v >actual &&
|
git status -v >actual &&
|
||||||
grep "\[1mdiff --git" actual
|
grep "diff --git negative negative" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
mesg_with_comment_and_newlines='
|
mesg_with_comment_and_newlines='
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
test_description='git status'
|
test_description='git status'
|
||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||||
|
|
||||||
test_expect_success 'status -h in broken repository' '
|
test_expect_success 'status -h in broken repository' '
|
||||||
git config --global advice.statusuoption false &&
|
git config --global advice.statusuoption false &&
|
||||||
@ -667,7 +668,7 @@ test_expect_success 'setup unique colors' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status with color.ui' '
|
test_expect_success TTY 'status with color.ui' '
|
||||||
cat >expect <<\EOF &&
|
cat >expect <<\EOF &&
|
||||||
On branch <GREEN>master<RESET>
|
On branch <GREEN>master<RESET>
|
||||||
Your branch and '\''upstream'\'' have diverged,
|
Your branch and '\''upstream'\'' have diverged,
|
||||||
@ -694,14 +695,14 @@ Untracked files:
|
|||||||
<BLUE>untracked<RESET>
|
<BLUE>untracked<RESET>
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
test_config color.ui always &&
|
test_config color.ui auto &&
|
||||||
git status | test_decode_color >output &&
|
test_terminal git status | test_decode_color >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status with color.status' '
|
test_expect_success TTY 'status with color.status' '
|
||||||
test_config color.status always &&
|
test_config color.status auto &&
|
||||||
git status | test_decode_color >output &&
|
test_terminal git status | test_decode_color >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -714,19 +715,19 @@ cat >expect <<\EOF
|
|||||||
<BLUE>??<RESET> untracked
|
<BLUE>??<RESET> untracked
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'status -s with color.ui' '
|
test_expect_success TTY 'status -s with color.ui' '
|
||||||
|
|
||||||
git config color.ui always &&
|
git config color.ui auto &&
|
||||||
git status -s | test_decode_color >output &&
|
test_terminal git status -s | test_decode_color >output &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status -s with color.status' '
|
test_expect_success TTY 'status -s with color.status' '
|
||||||
|
|
||||||
git config --unset color.ui &&
|
git config --unset color.ui &&
|
||||||
git config color.status always &&
|
git config color.status auto &&
|
||||||
git status -s | test_decode_color >output &&
|
test_terminal git status -s | test_decode_color >output &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
|
|
||||||
'
|
'
|
||||||
@ -741,9 +742,9 @@ cat >expect <<\EOF
|
|||||||
<BLUE>??<RESET> untracked
|
<BLUE>??<RESET> untracked
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'status -s -b with color.status' '
|
test_expect_success TTY 'status -s -b with color.status' '
|
||||||
|
|
||||||
git status -s -b | test_decode_color >output &&
|
test_terminal git status -s -b | test_decode_color >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
|
|
||||||
'
|
'
|
||||||
@ -757,20 +758,20 @@ A dir2/added
|
|||||||
?? untracked
|
?? untracked
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'status --porcelain ignores color.ui' '
|
test_expect_success TTY 'status --porcelain ignores color.ui' '
|
||||||
|
|
||||||
git config --unset color.status &&
|
git config --unset color.status &&
|
||||||
git config color.ui always &&
|
git config color.ui auto &&
|
||||||
git status --porcelain | test_decode_color >output &&
|
test_terminal git status --porcelain | test_decode_color >output &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status --porcelain ignores color.status' '
|
test_expect_success TTY 'status --porcelain ignores color.status' '
|
||||||
|
|
||||||
git config --unset color.ui &&
|
git config --unset color.ui &&
|
||||||
git config color.status always &&
|
git config color.status auto &&
|
||||||
git status --porcelain | test_decode_color >output &&
|
test_terminal git status --porcelain | test_decode_color >output &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
|
|
||||||
'
|
'
|
||||||
|
@ -80,6 +80,7 @@ sub copy_stdio {
|
|||||||
if ($#ARGV < 1) {
|
if ($#ARGV < 1) {
|
||||||
die "usage: test-terminal program args";
|
die "usage: test-terminal program args";
|
||||||
}
|
}
|
||||||
|
$ENV{TERM} = 'vt100';
|
||||||
my $master_in = new IO::Pty;
|
my $master_in = new IO::Pty;
|
||||||
my $master_out = new IO::Pty;
|
my $master_out = new IO::Pty;
|
||||||
my $master_err = new IO::Pty;
|
my $master_err = new IO::Pty;
|
||||||
|
Loading…
Reference in New Issue
Block a user