@@ -802,7 +802,6 @@ test_expect_success 'combined diff with autocrlf conversion' '
802
802
# Start testing the colored format for whitespace checks
803
803
804
804
test_expect_success ' setup diff colors' '
805
- git config color.diff always &&
806
805
git config color.diff.plain normal &&
807
806
git config color.diff.meta bold &&
808
807
git config color.diff.frag cyan &&
@@ -821,7 +820,7 @@ test_expect_success 'diff that introduces a line with only tabs' '
821
820
echo "test" >x &&
822
821
git commit -m "initial" x &&
823
822
echo "{NTN}" | tr "NT" "\n\t" >>x &&
824
- git -c color. diff=always diff | test_decode_color >current &&
823
+ git diff --color | test_decode_color >current &&
825
824
826
825
cat >expected <<-\EOF &&
827
826
<BOLD>diff --git a/x b/x<RESET>
@@ -851,7 +850,7 @@ test_expect_success 'diff that introduces and removes ws breakages' '
851
850
echo "2. and a new line "
852
851
} >x &&
853
852
854
- git -c color. diff=always diff |
853
+ git diff --color |
855
854
test_decode_color >current &&
856
855
857
856
cat >expected <<-\EOF &&
@@ -923,50 +922,50 @@ test_expect_success 'ws-error-highlight test setup' '
923
922
924
923
test_expect_success ' test --ws-error-highlight option' '
925
924
926
- git -c color. diff=always diff --ws-error-highlight=default,old |
925
+ git diff --color --ws-error-highlight=default,old |
927
926
test_decode_color >current &&
928
927
test_cmp expect.default-old current &&
929
928
930
- git -c color. diff=always diff --ws-error-highlight=all |
929
+ git diff --color --ws-error-highlight=all |
931
930
test_decode_color >current &&
932
931
test_cmp expect.all current &&
933
932
934
- git -c color. diff=always diff --ws-error-highlight=none |
933
+ git diff --color --ws-error-highlight=none |
935
934
test_decode_color >current &&
936
935
test_cmp expect.none current
937
936
938
937
'
939
938
940
939
test_expect_success ' test diff.wsErrorHighlight config' '
941
940
942
- git -c color. diff=always -c diff .wsErrorHighlight=default,old diff |
941
+ git -c diff.wsErrorHighlight=default,old diff --color |
943
942
test_decode_color >current &&
944
943
test_cmp expect.default-old current &&
945
944
946
- git -c color. diff=always -c diff .wsErrorHighlight=all diff |
945
+ git -c diff.wsErrorHighlight=all diff --color |
947
946
test_decode_color >current &&
948
947
test_cmp expect.all current &&
949
948
950
- git -c color. diff=always -c diff .wsErrorHighlight=none diff |
949
+ git -c diff.wsErrorHighlight=none diff --color |
951
950
test_decode_color >current &&
952
951
test_cmp expect.none current
953
952
954
953
'
955
954
956
955
test_expect_success ' option overrides diff.wsErrorHighlight' '
957
956
958
- git -c color.diff=always -c diff.wsErrorHighlight=none \
959
- diff --ws-error-highlight=default,old |
957
+ git -c diff.wsErrorHighlight=none \
958
+ diff --color -- ws-error-highlight=default,old |
960
959
test_decode_color >current &&
961
960
test_cmp expect.default-old current &&
962
961
963
- git -c color.diff=always -c diff.wsErrorHighlight=default \
964
- diff --ws-error-highlight=all |
962
+ git -c diff.wsErrorHighlight=default \
963
+ diff --color -- ws-error-highlight=all |
965
964
test_decode_color >current &&
966
965
test_cmp expect.all current &&
967
966
968
- git -c color.diff=always -c diff.wsErrorHighlight=all \
969
- diff --ws-error-highlight=none |
967
+ git -c diff.wsErrorHighlight=all \
968
+ diff --color -- ws-error-highlight=none |
970
969
test_decode_color >current &&
971
970
test_cmp expect.none current
972
971
@@ -986,7 +985,7 @@ test_expect_success 'detect moved code, complete file' '
986
985
git mv test.c main.c &&
987
986
test_config color.diff.oldMoved "normal red" &&
988
987
test_config color.diff.newMoved "normal green" &&
989
- git diff HEAD --color-moved=zebra --no-renames | test_decode_color >actual &&
988
+ git diff HEAD --color-moved=zebra --color -- no-renames | test_decode_color >actual &&
990
989
cat >expected <<-\EOF &&
991
990
<BOLD>diff --git a/main.c b/main.c<RESET>
992
991
<BOLD>new file mode 100644<RESET>
@@ -1087,7 +1086,7 @@ test_expect_success 'detect malicious moved code, inside file' '
1087
1086
bar();
1088
1087
}
1089
1088
EOF
1090
- git diff HEAD --no-renames --color-moved=zebra| test_decode_color >actual &&
1089
+ git diff HEAD --no-renames --color-moved=zebra --color | test_decode_color >actual &&
1091
1090
cat <<-\EOF >expected &&
1092
1091
<BOLD>diff --git a/main.c b/main.c<RESET>
1093
1092
<BOLD>index 27a619c..7cf9336 100644<RESET>
@@ -1136,7 +1135,7 @@ test_expect_success 'plain moved code, inside file' '
1136
1135
test_config color.diff.oldMovedAlternative "blue" &&
1137
1136
test_config color.diff.newMovedAlternative "yellow" &&
1138
1137
# needs previous test as setup
1139
- git diff HEAD --no-renames --color-moved=plain| test_decode_color >actual &&
1138
+ git diff HEAD --no-renames --color-moved=plain --color | test_decode_color >actual &&
1140
1139
cat <<-\EOF >expected &&
1141
1140
<BOLD>diff --git a/main.c b/main.c<RESET>
1142
1141
<BOLD>index 27a619c..7cf9336 100644<RESET>
@@ -1227,7 +1226,7 @@ test_expect_success 'detect permutations inside moved code -- dimmed_zebra' '
1227
1226
test_config color.diff.newMovedDimmed "normal cyan" &&
1228
1227
test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
1229
1228
test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
1230
- git diff HEAD --no-renames --color-moved=dimmed_zebra |
1229
+ git diff HEAD --no-renames --color-moved=dimmed_zebra --color |
1231
1230
grep -v "index" |
1232
1231
test_decode_color >actual &&
1233
1232
cat <<-\EOF >expected &&
@@ -1271,7 +1270,7 @@ test_expect_success 'cmd option assumes configured colored-moved' '
1271
1270
test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
1272
1271
test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
1273
1272
test_config diff.colorMoved zebra &&
1274
- git diff HEAD --no-renames --color-moved |
1273
+ git diff HEAD --no-renames --color-moved --color |
1275
1274
grep -v "index" |
1276
1275
test_decode_color >actual &&
1277
1276
cat <<-\EOF >expected &&
@@ -1343,7 +1342,7 @@ line 4
1343
1342
EOF
1344
1343
test_config color.diff.oldMoved "magenta" &&
1345
1344
test_config color.diff.newMoved "cyan" &&
1346
- git diff HEAD --no-renames --color-moved |
1345
+ git diff HEAD --no-renames --color-moved --color |
1347
1346
grep -v "index" |
1348
1347
test_decode_color >actual &&
1349
1348
cat <<-\EOF >expected &&
@@ -1364,7 +1363,7 @@ EOF
1364
1363
EOF
1365
1364
test_cmp expected actual &&
1366
1365
1367
- git diff HEAD --no-renames -w --color-moved |
1366
+ git diff HEAD --no-renames -w --color-moved --color |
1368
1367
grep -v "index" |
1369
1368
test_decode_color >actual &&
1370
1369
cat <<-\EOF >expected &&
@@ -1403,7 +1402,7 @@ test_expect_success '--color-moved block at end of diff output respects MIN_ALNU
1403
1402
irrelevant_line
1404
1403
EOF
1405
1404
1406
- git diff HEAD --color-moved=zebra --no-renames |
1405
+ git diff HEAD --color-moved=zebra --color -- no-renames |
1407
1406
grep -v "index" |
1408
1407
test_decode_color >actual &&
1409
1408
cat >expected <<-\EOF &&
@@ -1442,7 +1441,7 @@ test_expect_success '--color-moved respects MIN_ALNUM_COUNT' '
1442
1441
nineteen chars 456789
1443
1442
EOF
1444
1443
1445
- git diff HEAD --color-moved=zebra --no-renames |
1444
+ git diff HEAD --color-moved=zebra --color -- no-renames |
1446
1445
grep -v "index" |
1447
1446
test_decode_color >actual &&
1448
1447
cat >expected <<-\EOF &&
@@ -1485,7 +1484,7 @@ test_expect_success '--color-moved treats adjacent blocks as separate for MIN_AL
1485
1484
7charsA
1486
1485
EOF
1487
1486
1488
- git diff HEAD --color-moved=zebra --no-renames | grep -v "index" | test_decode_color >actual &&
1487
+ git diff HEAD --color-moved=zebra --color -- no-renames | grep -v "index" | test_decode_color >actual &&
1489
1488
cat >expected <<-\EOF &&
1490
1489
<BOLD>diff --git a/bar b/bar<RESET>
1491
1490
<BOLD>--- a/bar<RESET>
@@ -1519,15 +1518,15 @@ test_expect_success 'move detection with submodules' '
1519
1518
echo foul >bananas/recipe &&
1520
1519
echo ripe >fruit.t &&
1521
1520
1522
- git diff --submodule=diff --color-moved >actual &&
1521
+ git diff --submodule=diff --color-moved --color >actual &&
1523
1522
1524
1523
# no move detection as the moved line is across repository boundaries.
1525
1524
test_decode_color <actual >decoded_actual &&
1526
1525
! grep BGREEN decoded_actual &&
1527
1526
! grep BRED decoded_actual &&
1528
1527
1529
1528
# nor did we mess with it another way
1530
- git diff --submodule=diff | test_decode_color >expect &&
1529
+ git diff --submodule=diff --color | test_decode_color >expect &&
1531
1530
test_cmp expect decoded_actual
1532
1531
'
1533
1532
0 commit comments