diff options
author | Jeff King <peff@peff.net> | 2017-10-13 13:26:02 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-17 15:10:13 +0900 |
commit | b521fd122865dca88b99d05344ec189d39efcefb (patch) | |
tree | 6e1dbd9e849dfdc6d1bf00c0a4251f3f3e01758e | |
parent | Revert "color: check color.ui in git_default_config()" (diff) | |
download | tgif-b521fd122865dca88b99d05344ec189d39efcefb.tar.xz |
tag: respect color.ui config
Since 11b087adfd (ref-filter: consult want_color() before
emitting colors, 2017-07-13), we expect that setting
"color.ui" to "always" will enable color tag formats even
without a tty. As that commit was built on top of
136c8c8b8f (color: check color.ui in git_default_config(),
2017-07-13) from the same series, we didn't need to touch
tag's config parsing at all.
However, since we reverted 136c8c8b8f, we now need to
explicitly call git_color_default_config() to make this
work.
Let's do so, and also restore the test dropped in 0c88bf5050
(provide --color option for all ref-filter users,
2017-10-03). That commit swapped out our "color.ui=always"
test for "--color" in preparation for "always" going away.
But since it is here to stay, we should test both cases.
Note that for-each-ref also lost its color.ui support as
part of reverting 136c8c8b8f. But as a plumbing command, it
should _not_ respect the color.ui config. Since it also
gained a --color option in 0c88bf5050, that's the correct
way to ask it for color. We'll continue to test that, and
confirm that "color.ui" is not respected.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/tag.c | 2 | ||||
-rwxr-xr-x | t/t6300-for-each-ref.sh | 5 | ||||
-rwxr-xr-x | t/t7004-tag.sh | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/builtin/tag.c b/builtin/tag.c index fe0a8ab944..00382a56f5 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -158,7 +158,7 @@ static int git_tag_config(const char *var, const char *value, void *cb) if (starts_with(var, "column.")) return git_column_config(var, value, "tag", &colopts); - return git_default_config(var, value, cb); + return git_color_default_config(var, value, cb); } static void write_tag_body(int fd, const struct object_id *oid) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 6358134805..09f2b7799d 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -441,6 +441,11 @@ test_expect_success '--color can override tty check' ' test_cmp expected.color actual ' +test_expect_success 'color.ui=always does not override tty check' ' + git -c color.ui=always for-each-ref --format="$color_format" >actual && + test_cmp expected.bare actual +' + cat >expected <<\EOF heads/master tags/master diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index b90db1bf74..62aa322846 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1925,6 +1925,12 @@ test_expect_success '--color overrides auto-color' ' 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_decode_color <actual.raw >actual && + test_cmp expect.color actual +' + test_expect_success 'setup --merged test tags' ' git tag mergetest-1 HEAD~2 && git tag mergetest-2 HEAD~1 && |