@@ -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 &&
@@ -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