Skip to content

Commit aac4e0b

Browse files
ldenningtondscho
authored andcommitted
Merge pull request #419 from ldennington/sparse-index-diff
diff: enable and test the sparse index
2 parents 84c31ee + 4ccf17b commit aac4e0b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,43 @@ test_expect_success 'diff --cached' '
488488
test_all_match git diff --cached
489489
'
490490

491+
test_expect_success 'diff partially-staged' '
492+
init_repos &&
493+
494+
write_script edit-contents <<-\EOF &&
495+
echo text >>$1
496+
EOF
497+
498+
# Add file within cone
499+
test_all_match git sparse-checkout set deep &&
500+
run_on_all ../edit-contents deep/testfile &&
501+
test_all_match git add deep/testfile &&
502+
run_on_all ../edit-contents deep/testfile &&
503+
504+
test_all_match git diff &&
505+
test_all_match git diff --staged &&
506+
507+
# Add file outside cone
508+
test_all_match git reset --hard &&
509+
run_on_all mkdir newdirectory &&
510+
run_on_all ../edit-contents newdirectory/testfile &&
511+
test_all_match git sparse-checkout set newdirectory &&
512+
test_all_match git add newdirectory/testfile &&
513+
run_on_all ../edit-contents newdirectory/testfile &&
514+
test_all_match git sparse-checkout set &&
515+
516+
test_all_match git diff &&
517+
test_all_match git diff --staged &&
518+
519+
# Merge conflict outside cone
520+
test_all_match git reset --hard &&
521+
test_all_match git checkout merge-left &&
522+
test_all_match test_must_fail git merge merge-right &&
523+
524+
test_all_match git diff &&
525+
test_all_match git diff --staged
526+
'
527+
491528
# NEEDSWORK: sparse-checkout behaves differently from full-checkout when
492529
# running this test with 'df-conflict-2' after 'df-conflict-1'.
493530
test_expect_success 'diff with renames and conflicts' '
@@ -1391,6 +1428,11 @@ test_expect_success 'sparse-index is not expanded' '
13911428
ensure_not_expanded reset --merge update-deep &&
13921429
ensure_not_expanded reset --hard &&
13931430
1431+
echo a test change >>sparse-index/README.md &&
1432+
ensure_not_expanded diff &&
1433+
git -C sparse-index add README.md &&
1434+
ensure_not_expanded diff --staged &&
1435+
13941436
ensure_not_expanded reset base -- deep/a &&
13951437
ensure_not_expanded reset base -- nonexistent-file &&
13961438
ensure_not_expanded reset deepest -- deep &&

0 commit comments

Comments
 (0)