Skip to content

Commit 1b38efc

Browse files
derrickstoleegitster
authored andcommitted
t1092: add deeper changes during a checkout
Extend the repository data in the setup of t1092 to include more directories within two parent directories. This reproduces a bug found by users of the sparse index feature with suitably-complicated sparse-checkout definitions. Add a failing test that fails in its first 'git checkout deepest' run in the sparse index case with this error: error: Your local changes to the following files would be overwritten by checkout: deep/deeper1/deepest2/a deep/deeper1/deepest3/a Please commit your changes or stash them before you switch branches. Aborting The next change will fix this error, and that fix will make it clear why the extra depth is necessary for revealing this bug. The assignment of the sparse-checkout definition to include deep/deeper1/deepest as a sibling directory is important to ensure that deep/deeper1 is not a sparse directory entry, but deep/deeper1/deepest2 is. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e9d7761 commit 1b38efc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ test_expect_success 'setup' '
1919
mkdir folder1 folder2 deep x &&
2020
mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
2121
mkdir deep/deeper1/deepest &&
22+
mkdir deep/deeper1/deepest2 &&
23+
mkdir deep/deeper1/deepest3 &&
2224
echo "after deeper1" >deep/e &&
2325
echo "after deepest" >deep/deeper1/e &&
2426
cp a folder1 &&
@@ -30,7 +32,9 @@ test_expect_success 'setup' '
3032
cp a deep/deeper2 &&
3133
cp a deep/later &&
3234
cp a deep/deeper1/deepest &&
33-
cp -r deep/deeper1/deepest deep/deeper2 &&
35+
cp a deep/deeper1/deepest2 &&
36+
cp a deep/deeper1/deepest3 &&
37+
cp -r deep/deeper1/ deep/deeper2 &&
3438
mkdir deep/deeper1/0 &&
3539
mkdir deep/deeper1/0/0 &&
3640
touch deep/deeper1/0/1 &&
@@ -126,6 +130,8 @@ test_expect_success 'setup' '
126130
127131
git checkout -b deepest base &&
128132
echo "updated deepest" >deep/deeper1/deepest/a &&
133+
echo "updated deepest2" >deep/deeper1/deepest2/a &&
134+
echo "updated deepest3" >deep/deeper1/deepest3/a &&
129135
git commit -a -m "update deepest" &&
130136
131137
git checkout -f base &&
@@ -301,6 +307,14 @@ test_expect_success 'add, commit, checkout' '
301307
test_all_match git checkout -
302308
'
303309

310+
test_expect_failure 'deep changes during checkout' '
311+
init_repos &&
312+
313+
test_sparse_match git sparse-checkout set deep/deeper1/deepest &&
314+
test_all_match git checkout deepest &&
315+
test_all_match git checkout base
316+
'
317+
304318
test_expect_success 'add outside sparse cone' '
305319
init_repos &&
306320

0 commit comments

Comments
 (0)