Skip to content

Commit 4b312b5

Browse files
ldenningtondscho
authored andcommitted
Merge pull request microsoft#419 from ldennington/sparse-index-diff
diff: enable and test the sparse index
2 parents a58c44b + b882f76 commit 4b312b5

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
@@ -428,6 +428,43 @@ test_expect_success 'diff --cached' '
428428
test_all_match git diff --cached
429429
'
430430

431+
test_expect_success 'diff partially-staged' '
432+
init_repos &&
433+
434+
write_script edit-contents <<-\EOF &&
435+
echo text >>$1
436+
EOF
437+
438+
# Add file within cone
439+
test_all_match git sparse-checkout set deep &&
440+
run_on_all ../edit-contents deep/testfile &&
441+
test_all_match git add deep/testfile &&
442+
run_on_all ../edit-contents deep/testfile &&
443+
444+
test_all_match git diff &&
445+
test_all_match git diff --staged &&
446+
447+
# Add file outside cone
448+
test_all_match git reset --hard &&
449+
run_on_all mkdir newdirectory &&
450+
run_on_all ../edit-contents newdirectory/testfile &&
451+
test_all_match git sparse-checkout set newdirectory &&
452+
test_all_match git add newdirectory/testfile &&
453+
run_on_all ../edit-contents newdirectory/testfile &&
454+
test_all_match git sparse-checkout set &&
455+
456+
test_all_match git diff &&
457+
test_all_match git diff --staged &&
458+
459+
# Merge conflict outside cone
460+
test_all_match git reset --hard &&
461+
test_all_match git checkout merge-left &&
462+
test_all_match test_must_fail git merge merge-right &&
463+
464+
test_all_match git diff &&
465+
test_all_match git diff --staged
466+
'
467+
431468
# NEEDSWORK: sparse-checkout behaves differently from full-checkout when
432469
# running this test with 'df-conflict-2' after 'df-conflict-1'.
433470
test_expect_success 'diff with renames and conflicts' '
@@ -911,6 +948,11 @@ test_expect_success 'sparse-index is not expanded' '
911948
ensure_not_expanded reset --merge update-deep &&
912949
ensure_not_expanded reset --hard &&
913950
951+
echo a test change >>sparse-index/README.md &&
952+
ensure_not_expanded diff &&
953+
git -C sparse-index add README.md &&
954+
ensure_not_expanded diff --staged &&
955+
914956
ensure_not_expanded reset base -- deep/a &&
915957
ensure_not_expanded reset base -- nonexistent-file &&
916958
ensure_not_expanded reset deepest -- deep &&

0 commit comments

Comments
 (0)