Skip to content

Commit 1c0c804

Browse files
vdyedscho
authored andcommitted
Merge pull request #430 from vdye/sparse-index/clean
Sparse index: integrate with `clean` and `stash -u`
2 parents 88ddfa6 + 4301124 commit 1c0c804

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,46 @@ test_expect_success 'sparse index is not expanded: sparse-checkout' '
18361836
ensure_not_expanded sparse-checkout set
18371837
'
18381838

1839+
# NEEDSWORK: although the full repository's index is _not_ expanded as part of
1840+
# stash, a temporary index, which is _not_ sparse, is created when stashing and
1841+
# applying a stash of untracked files. As a result, the test reports that it
1842+
# finds an instance of `ensure_full_index`, but it does not carry with it the
1843+
# performance implications of expanding the full repository index.
1844+
test_expect_success 'sparse index is not expanded: stash -u' '
1845+
init_repos &&
1846+
1847+
mkdir -p sparse-index/folder1 &&
1848+
echo >>sparse-index/README.md &&
1849+
echo >>sparse-index/a &&
1850+
echo >>sparse-index/folder1/new &&
1851+
1852+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
1853+
git -C sparse-index stash -u &&
1854+
test_region index ensure_full_index trace2.txt &&
1855+
1856+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
1857+
git -C sparse-index stash pop &&
1858+
test_region index ensure_full_index trace2.txt
1859+
'
1860+
1861+
# NEEDSWORK: similar to `git add`, untracked files outside of the sparse
1862+
# checkout definition are successfully stashed and unstashed.
1863+
test_expect_success 'stash -u outside sparse checkout definition' '
1864+
init_repos &&
1865+
1866+
write_script edit-contents <<-\EOF &&
1867+
echo text >>$1
1868+
EOF
1869+
1870+
run_on_sparse mkdir -p folder1 &&
1871+
run_on_all ../edit-contents folder1/new &&
1872+
test_all_match git stash -u &&
1873+
test_all_match git status --porcelain=v2 &&
1874+
1875+
test_all_match git stash pop -q &&
1876+
test_all_match git status --porcelain=v2
1877+
'
1878+
18391879
# NEEDSWORK: a sparse-checkout behaves differently from a full checkout
18401880
# in this scenario, but it shouldn't.
18411881
test_expect_success 'reset mixed and checkout orphan' '

0 commit comments

Comments
 (0)