t4015: prefer --color to -c color.diff=always

t4015 contains many color-related tests which need to override the "is stdout a tty" check. They do so by setting the color.diff config, but we can accomplish the same with the --color option. Besides being shorter to type, switching will prepare us for upcoming changes to "always" when see it in config. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 3, 2017 at 09:40 UTC a655a595957b873e3fa9f8569568536eb547c4c8
1 file changed +14 -14
t/t4015-diff-whitespace.sh
+14 -14
@@ -821,7 +821,7 @@ test_expect_success 'diff that introduces a line with only tabs' '
821 echo "test" >x &&
822 git commit -m "initial" x &&
823 echo "{NTN}" | tr "NT" "\n\t" >>x &&
824 - git -c color.diff=always diff | test_decode_color >current &&
824 + git diff --color | test_decode_color >current &&
825
826 cat >expected <<-\EOF &&
827 <BOLD>diff --git a/x b/x<RESET>
@@ -851,7 +851,7 @@ test_expect_success 'diff that introduces and removes ws breakages' '
851 echo "2. and a new line "
852 } >x &&
853
854 - git -c color.diff=always diff |
854 + git diff --color |
855 test_decode_color >current &&
856
857 cat >expected <<-\EOF &&
@@ -923,15 +923,15 @@ test_expect_success 'ws-error-highlight test setup' '
923
924 test_expect_success 'test --ws-error-highlight option' '
925
926 - git -c color.diff=always diff --ws-error-highlight=default,old |
926 + git diff --color --ws-error-highlight=default,old |
927 test_decode_color >current &&
928 test_cmp expect.default-old current &&
929
930 - git -c color.diff=always diff --ws-error-highlight=all |
930 + git diff --color --ws-error-highlight=all |
931 test_decode_color >current &&
932 test_cmp expect.all current &&
933
934 - git -c color.diff=always diff --ws-error-highlight=none |
934 + git diff --color --ws-error-highlight=none |
935 test_decode_color >current &&
936 test_cmp expect.none current
937
@@ -939,15 +939,15 @@ test_expect_success 'test --ws-error-highlight option' '
939
940 test_expect_success 'test diff.wsErrorHighlight config' '
941
942 - git -c color.diff=always -c diff.wsErrorHighlight=default,old diff |
942 + git -c diff.wsErrorHighlight=default,old diff --color |
943 test_decode_color >current &&
944 test_cmp expect.default-old current &&
945
946 - git -c color.diff=always -c diff.wsErrorHighlight=all diff |
946 + git -c diff.wsErrorHighlight=all diff --color |
947 test_decode_color >current &&
948 test_cmp expect.all current &&
949
950 - git -c color.diff=always -c diff.wsErrorHighlight=none diff |
950 + git -c diff.wsErrorHighlight=none diff --color |
951 test_decode_color >current &&
952 test_cmp expect.none current
953
@@ -955,18 +955,18 @@ test_expect_success 'test diff.wsErrorHighlight config' '
955
956 test_expect_success 'option overrides diff.wsErrorHighlight' '
957
958 - git -c color.diff=always -c diff.wsErrorHighlight=none \
959 - diff --ws-error-highlight=default,old |
958 + git -c diff.wsErrorHighlight=none \
959 + diff --color --ws-error-highlight=default,old |
960 test_decode_color >current &&
961 test_cmp expect.default-old current &&
962
963 - git -c color.diff=always -c diff.wsErrorHighlight=default \
964 - diff --ws-error-highlight=all |
963 + git -c diff.wsErrorHighlight=default \
964 + diff --color --ws-error-highlight=all |
965 test_decode_color >current &&
966 test_cmp expect.all current &&
967
968 - git -c color.diff=always -c diff.wsErrorHighlight=all \
969 - diff --ws-error-highlight=none |
968 + git -c diff.wsErrorHighlight=all \
969 + diff --color --ws-error-highlight=none |
970 test_decode_color >current &&
971 test_cmp expect.none current
972