From e433749d86c55af27f762c862dbb06d1e108da13 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Oct 2017 09:39:34 -0400 Subject: test-terminal: set TERM=vt100 The point of the test-terminal script is to simulate in the test scripts an environment where output is going to a real terminal. But since test-lib.sh also sets TERM=dumb, the simulation isn't very realistic. The color code will skip auto-coloring for TERM=dumb, leading to us liberally sprinkling test_terminal env TERM=vt100 git ... through the test suite to convince the tests to actually generate colors. Let's set TERM for programs run under test_terminal, which is one less thing for test-writers to remember. In most cases the callers can be simplified, but note there is one interesting case in t4202. It uses test_terminal to check the auto-enabling of --decorate, but the expected output _doesn't_ contain colors (because TERM=dumb suppresses them). Using TERM=vt100 is closer to what the real world looks like; adjust the expected output to match. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t7004-tag.sh') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index dd5ba450ee..6dc44478f9 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1914,7 +1914,7 @@ test_expect_success '%(color) omitted without 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 && test_cmp expect.color actual ' -- cgit v1.2.3 From 0c88bf50502e2be7d7d8965052d77bbf08e1d519 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Oct 2017 09:45:47 -0400 Subject: provide --color option for all ref-filter users When ref-filter learned about want_color() in 11b087adfd (ref-filter: consult want_color() before emitting colors, 2017-07-13), it became useful to be able to turn colors off and on for specific commands. For git-branch, you can do so with --color/--no-color. But for git-for-each-ref and git-tag, the other users of ref-filter, you have no option except to tweak the "color.ui" config setting. Let's give both of these commands the usual color command-line options. This is a bit more obvious as a method for overriding the config. And it also prepares us for the behavior of "always" changing (so that we are still left with a way of forcing color when our output goes to a non-terminal). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t7004-tag.sh') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 6dc44478f9..f5547371a3 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1919,8 +1919,8 @@ test_expect_success TTY '%(color) present with tty' ' test_cmp expect.color actual ' -test_expect_success 'color.ui=always overrides auto-color' ' - git -c color.ui=always tag $color_args >actual.raw && +test_expect_success '--color overrides auto-color' ' + git tag --color $color_args >actual.raw && test_decode_color actual && test_cmp expect.color actual ' -- cgit v1.2.3