@@ -1223,7 +1223,7 @@ test_expect_success 'plain moved code, inside file' '
1223
1223
test_cmp expected actual
1224
1224
'
1225
1225
1226
- test_expect_success ' detect permutations inside moved code -- dimmed_zebra ' '
1226
+ test_expect_success ' detect blocks of moved code' '
1227
1227
git reset --hard &&
1228
1228
cat <<-\EOF >lines.txt &&
1229
1229
long line 1
@@ -1271,6 +1271,50 @@ test_expect_success 'detect permutations inside moved code -- dimmed_zebra' '
1271
1271
test_config color.diff.newMovedDimmed "normal cyan" &&
1272
1272
test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
1273
1273
test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
1274
+ git diff HEAD --no-renames --color-moved=blocks --color >actual.raw &&
1275
+ grep -v "index" actual.raw | test_decode_color >actual &&
1276
+ cat <<-\EOF >expected &&
1277
+ <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
1278
+ <BOLD>--- a/lines.txt<RESET>
1279
+ <BOLD>+++ b/lines.txt<RESET>
1280
+ <CYAN>@@ -1,16 +1,16 @@<RESET>
1281
+ <MAGENTA>-long line 1<RESET>
1282
+ <MAGENTA>-long line 2<RESET>
1283
+ <MAGENTA>-long line 3<RESET>
1284
+ line 4<RESET>
1285
+ line 5<RESET>
1286
+ line 6<RESET>
1287
+ line 7<RESET>
1288
+ line 8<RESET>
1289
+ line 9<RESET>
1290
+ <CYAN>+<RESET><CYAN>long line 1<RESET>
1291
+ <CYAN>+<RESET><CYAN>long line 2<RESET>
1292
+ <CYAN>+<RESET><CYAN>long line 3<RESET>
1293
+ <CYAN>+<RESET><CYAN>long line 14<RESET>
1294
+ <CYAN>+<RESET><CYAN>long line 15<RESET>
1295
+ <CYAN>+<RESET><CYAN>long line 16<RESET>
1296
+ line 10<RESET>
1297
+ line 11<RESET>
1298
+ line 12<RESET>
1299
+ line 13<RESET>
1300
+ <MAGENTA>-long line 14<RESET>
1301
+ <MAGENTA>-long line 15<RESET>
1302
+ <MAGENTA>-long line 16<RESET>
1303
+ EOF
1304
+ test_cmp expected actual
1305
+
1306
+ '
1307
+
1308
+ test_expect_success ' detect permutations inside moved code -- dimmed_zebra' '
1309
+ # reuse setup from test before!
1310
+ test_config color.diff.oldMoved "magenta" &&
1311
+ test_config color.diff.newMoved "cyan" &&
1312
+ test_config color.diff.oldMovedAlternative "blue" &&
1313
+ test_config color.diff.newMovedAlternative "yellow" &&
1314
+ test_config color.diff.oldMovedDimmed "normal magenta" &&
1315
+ test_config color.diff.newMovedDimmed "normal cyan" &&
1316
+ test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
1317
+ test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
1274
1318
git diff HEAD --no-renames --color-moved=dimmed_zebra --color >actual.raw &&
1275
1319
grep -v "index" actual.raw | test_decode_color >actual &&
1276
1320
cat <<-\EOF >expected &&
@@ -1669,7 +1713,8 @@ test_expect_success '--color-moved treats adjacent blocks as separate for MIN_AL
1669
1713
7charsA
1670
1714
EOF
1671
1715
1672
- git diff HEAD --color-moved=zebra --color --no-renames | grep -v "index" | test_decode_color >actual &&
1716
+ git diff HEAD --color-moved=zebra --color --no-renames >actual.raw &&
1717
+ grep -v "index" actual.raw | test_decode_color >actual &&
1673
1718
cat >expected <<-\EOF &&
1674
1719
<BOLD>diff --git a/bar b/bar<RESET>
1675
1720
<BOLD>--- a/bar<RESET>
0 commit comments