@@ -803,6 +803,8 @@ test_expect_success 'update-index --remove outside sparse definition' '
803
803
test_sparse_match git diff --cached --name-status &&
804
804
test_cmp expect sparse-checkout-out &&
805
805
806
+ test_sparse_match git diff-index --cached HEAD &&
807
+
806
808
# Reset the state
807
809
test_all_match git reset --hard &&
808
810
@@ -812,6 +814,8 @@ test_expect_success 'update-index --remove outside sparse definition' '
812
814
test_sparse_match git diff --cached --name-status &&
813
815
test_must_be_empty sparse-checkout-out &&
814
816
817
+ test_sparse_match git diff-index --cached HEAD &&
818
+
815
819
# Reset the state
816
820
test_all_match git reset --hard &&
817
821
@@ -823,7 +827,9 @@ test_expect_success 'update-index --remove outside sparse definition' '
823
827
D folder1/a
824
828
EOF
825
829
test_sparse_match git diff --cached --name-status &&
826
- test_cmp expect sparse-checkout-out
830
+ test_cmp expect sparse-checkout-out &&
831
+
832
+ test_sparse_match git diff-index --cached HEAD
827
833
'
828
834
829
835
test_expect_success ' update-index with directories' '
@@ -1551,7 +1557,7 @@ test_expect_success 'sparse-index is not expanded: describe' '
1551
1557
ensure_not_expanded describe
1552
1558
'
1553
1559
1554
- test_expect_success ' sparse index is not expanded: diff' '
1560
+ test_expect_success ' sparse index is not expanded: diff and diff-index ' '
1555
1561
init_repos &&
1556
1562
1557
1563
write_script edit-contents <<-\EOF &&
@@ -1568,6 +1574,7 @@ test_expect_success 'sparse index is not expanded: diff' '
1568
1574
test_all_match git diff --cached &&
1569
1575
ensure_not_expanded diff &&
1570
1576
ensure_not_expanded diff --cached &&
1577
+ ensure_not_expanded diff-index --cached HEAD &&
1571
1578
1572
1579
# Add file outside cone
1573
1580
test_all_match git reset --hard &&
@@ -1582,6 +1589,7 @@ test_expect_success 'sparse index is not expanded: diff' '
1582
1589
test_all_match git diff --cached &&
1583
1590
ensure_not_expanded diff &&
1584
1591
ensure_not_expanded diff --cached &&
1592
+ ensure_not_expanded diff-index --cached HEAD &&
1585
1593
1586
1594
# Merge conflict outside cone
1587
1595
# The sparse checkout will report a warning that is not in the
@@ -1594,7 +1602,8 @@ test_expect_success 'sparse index is not expanded: diff' '
1594
1602
test_all_match git diff &&
1595
1603
test_all_match git diff --cached &&
1596
1604
ensure_not_expanded diff &&
1597
- ensure_not_expanded diff --cached
1605
+ ensure_not_expanded diff --cached &&
1606
+ ensure_not_expanded diff-index --cached HEAD
1598
1607
'
1599
1608
1600
1609
test_expect_success ' sparse index is not expanded: show and rev-parse' '
0 commit comments