diff options
-rw-r--r-- | Documentation/git-for-each-ref.txt | 5 | ||||
-rw-r--r-- | Documentation/git-tag.txt | 5 | ||||
-rw-r--r-- | builtin/for-each-ref.c | 1 | ||||
-rw-r--r-- | builtin/tag.c | 1 | ||||
-rwxr-xr-x | t/t6300-for-each-ref.sh | 4 | ||||
-rwxr-xr-x | t/t7004-tag.sh | 4 |
6 files changed, 16 insertions, 4 deletions
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index cc42c12832..b92ebd0cd9 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -55,6 +55,11 @@ OPTIONS literally, in the latter case matching completely or from the 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:: --perl:: --python:: diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index 1eb15afa1c..a1399a78a0 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -115,6 +115,11 @@ options for details. variable if it exists, or lexicographic order otherwise. See 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:: --ignore-case:: Sorting and filtering tags are case insensitive. diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 5d7c921a77..e931be9ce4 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -36,6 +36,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) OPT_GROUP(""), 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__COLOR(&format.use_color, N_("respect format colors")), OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"), N_("field name to sort on"), &parse_opt_ref_sorting), OPT_CALLBACK(0, "points-at", &filter.points_at, diff --git a/builtin/tag.c b/builtin/tag.c index 66e35b823b..b9d1a13af5 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -411,6 +411,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) }, 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_BOOL('i', "ignore-case", &icase, N_("sorting and filtering are case insensitive")), OPT_END() }; diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index d6bffe6273..6358134805 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -435,8 +435,8 @@ test_expect_success '%(color) does not show color without tty' ' test_cmp expected.bare actual ' -test_expect_success 'color.ui=always can override tty check' ' - git -c color.ui=always for-each-ref --format="$color_format" >actual.raw && +test_expect_success '--color can override tty check' ' + git for-each-ref --color --format="$color_format" >actual.raw && test_decode_color <actual.raw >actual && test_cmp expected.color actual ' 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.raw >actual && test_cmp expect.color actual ' |