Skip to content

Commit a655a59

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e433749 commit a655a59

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

t/t4015-diff-whitespace.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ test_expect_success 'diff that introduces a line with only tabs' '
821821
echo "test" >x &&
822822
git commit -m "initial" x &&
823823
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 &&
825825
826826
cat >expected <<-\EOF &&
827827
<BOLD>diff --git a/x b/x<RESET>
@@ -851,7 +851,7 @@ test_expect_success 'diff that introduces and removes ws breakages' '
851851
echo "2. and a new line "
852852
} >x &&
853853
854-
git -c color.diff=always diff |
854+
git diff --color |
855855
test_decode_color >current &&
856856
857857
cat >expected <<-\EOF &&
@@ -923,50 +923,50 @@ test_expect_success 'ws-error-highlight test setup' '
923923

924924
test_expect_success 'test --ws-error-highlight option' '
925925
926-
git -c color.diff=always diff --ws-error-highlight=default,old |
926+
git diff --color --ws-error-highlight=default,old |
927927
test_decode_color >current &&
928928
test_cmp expect.default-old current &&
929929
930-
git -c color.diff=always diff --ws-error-highlight=all |
930+
git diff --color --ws-error-highlight=all |
931931
test_decode_color >current &&
932932
test_cmp expect.all current &&
933933
934-
git -c color.diff=always diff --ws-error-highlight=none |
934+
git diff --color --ws-error-highlight=none |
935935
test_decode_color >current &&
936936
test_cmp expect.none current
937937
938938
'
939939

940940
test_expect_success 'test diff.wsErrorHighlight config' '
941941
942-
git -c color.diff=always -c diff.wsErrorHighlight=default,old diff |
942+
git -c diff.wsErrorHighlight=default,old diff --color |
943943
test_decode_color >current &&
944944
test_cmp expect.default-old current &&
945945
946-
git -c color.diff=always -c diff.wsErrorHighlight=all diff |
946+
git -c diff.wsErrorHighlight=all diff --color |
947947
test_decode_color >current &&
948948
test_cmp expect.all current &&
949949
950-
git -c color.diff=always -c diff.wsErrorHighlight=none diff |
950+
git -c diff.wsErrorHighlight=none diff --color |
951951
test_decode_color >current &&
952952
test_cmp expect.none current
953953
954954
'
955955

956956
test_expect_success 'option overrides diff.wsErrorHighlight' '
957957
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 |
960960
test_decode_color >current &&
961961
test_cmp expect.default-old current &&
962962
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 |
965965
test_decode_color >current &&
966966
test_cmp expect.all current &&
967967
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 |
970970
test_decode_color >current &&
971971
test_cmp expect.none current
972972

0 commit comments

Comments
 (0)