Skip to content

Commit 855bc6c

Browse files
vdyedscho
authored andcommitted
Merge pull request #430 from vdye/sparse-index/clean
Sparse index: integrate with `clean` and `stash -u`
2 parents 4ea711d + ebea5eb commit 855bc6c

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
@@ -1909,6 +1909,46 @@ test_expect_success 'sparse index is not expanded: sparse-checkout' '
19091909
ensure_not_expanded sparse-checkout set
19101910
'
19111911

1912+
# NEEDSWORK: although the full repository's index is _not_ expanded as part of
1913+
# stash, a temporary index, which is _not_ sparse, is created when stashing and
1914+
# applying a stash of untracked files. As a result, the test reports that it
1915+
# finds an instance of `ensure_full_index`, but it does not carry with it the
1916+
# performance implications of expanding the full repository index.
1917+
test_expect_success 'sparse index is not expanded: stash -u' '
1918+
init_repos &&
1919+
1920+
mkdir -p sparse-index/folder1 &&
1921+
echo >>sparse-index/README.md &&
1922+
echo >>sparse-index/a &&
1923+
echo >>sparse-index/folder1/new &&
1924+
1925+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
1926+
git -C sparse-index stash -u &&
1927+
test_region index ensure_full_index trace2.txt &&
1928+
1929+
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
1930+
git -C sparse-index stash pop &&
1931+
test_region index ensure_full_index trace2.txt
1932+
'
1933+
1934+
# NEEDSWORK: similar to `git add`, untracked files outside of the sparse
1935+
# checkout definition are successfully stashed and unstashed.
1936+
test_expect_success 'stash -u outside sparse checkout definition' '
1937+
init_repos &&
1938+
1939+
write_script edit-contents <<-\EOF &&
1940+
echo text >>$1
1941+
EOF
1942+
1943+
run_on_sparse mkdir -p folder1 &&
1944+
run_on_all ../edit-contents folder1/new &&
1945+
test_all_match git stash -u &&
1946+
test_all_match git status --porcelain=v2 &&
1947+
1948+
test_all_match git stash pop -q &&
1949+
test_all_match git status --porcelain=v2
1950+
'
1951+
19121952
# NEEDSWORK: a sparse-checkout behaves differently from a full checkout
19131953
# in this scenario, but it shouldn't.
19141954
test_expect_success 'reset mixed and checkout orphan' '

0 commit comments

Comments
 (0)