Skip to content

Commit e669ffb

Browse files
derrickstoleegitster
authored andcommitted
t1092: expand repository data shape
As more features integrate with the sparse-index feature, more and more special cases arise that require different data shapes within the tree structure of the repository in order to demonstrate those cases. Add several interesting special cases all at once instead of sprinkling them across several commits. The interesting cases being added here are: * Add sparse-directory entries on both sides of directories within the sparse-checkout definition. * Add directories outside the sparse-checkout definition who have only one entry and are the first entry of a directory with multiple entries. * Add filenames adjacent to a sparse directory entry that sort before and after the trailing slash. Later tests will take advantage of these shapes, but they also deepen the tests that already exist. Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d814b5 commit e669ffb

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,31 @@ test_expect_success 'setup' '
1717
echo "after folder1" >g &&
1818
echo "after x" >z &&
1919
mkdir folder1 folder2 deep x &&
20-
mkdir deep/deeper1 deep/deeper2 &&
20+
mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
2121
mkdir deep/deeper1/deepest &&
2222
echo "after deeper1" >deep/e &&
2323
echo "after deepest" >deep/deeper1/e &&
2424
cp a folder1 &&
2525
cp a folder2 &&
2626
cp a x &&
2727
cp a deep &&
28+
cp a deep/before &&
2829
cp a deep/deeper1 &&
2930
cp a deep/deeper2 &&
31+
cp a deep/later &&
3032
cp a deep/deeper1/deepest &&
3133
cp -r deep/deeper1/deepest deep/deeper2 &&
34+
mkdir deep/deeper1/0 &&
35+
mkdir deep/deeper1/0/0 &&
36+
touch deep/deeper1/0/1 &&
37+
touch deep/deeper1/0/0/0 &&
38+
>folder1- &&
39+
>folder1.x &&
40+
>folder10 &&
41+
cp -r deep/deeper1/0 folder1 &&
42+
cp -r deep/deeper1/0 folder2 &&
43+
echo >>folder1/0/0/0 &&
44+
echo >>folder2/0/1 &&
3245
git add . &&
3346
git commit -m "initial commit" &&
3447
git checkout -b base &&
@@ -56,18 +69,27 @@ test_expect_success 'setup' '
5669
mv folder1/a folder2/b &&
5770
mv folder1/larger-content folder2/edited-content &&
5871
echo >>folder2/edited-content &&
72+
echo >>folder2/0/1 &&
73+
echo stuff >>deep/deeper1/a &&
5974
git add . &&
6075
git commit -m "rename folder1/... to folder2/..." &&
6176
6277
git checkout -b rename-out-to-in rename-base &&
6378
mv folder1/a deep/deeper1/b &&
79+
echo more stuff >>deep/deeper1/a &&
80+
rm folder2/0/1 &&
81+
mkdir folder2/0/1 &&
82+
echo >>folder2/0/1/1 &&
6483
mv folder1/larger-content deep/deeper1/edited-content &&
6584
echo >>deep/deeper1/edited-content &&
6685
git add . &&
6786
git commit -m "rename folder1/... to deep/deeper1/..." &&
6887
6988
git checkout -b rename-in-to-out rename-base &&
7089
mv deep/deeper1/a folder1/b &&
90+
echo >>folder2/0/1 &&
91+
rm -rf folder1/0/0 &&
92+
echo >>folder1/0/0 &&
7193
mv deep/deeper1/larger-content folder1/edited-content &&
7294
echo >>folder1/edited-content &&
7395
git add . &&
@@ -262,13 +284,29 @@ test_expect_success 'diff --staged' '
262284
test_all_match git diff --staged
263285
'
264286

265-
test_expect_success 'diff with renames' '
287+
test_expect_success 'diff with renames and conflicts' '
266288
init_repos &&
267289
268290
for branch in rename-out-to-out rename-out-to-in rename-in-to-out
269291
do
270292
test_all_match git checkout rename-base &&
271-
test_all_match git checkout $branch -- .&&
293+
test_all_match git checkout $branch -- . &&
294+
test_all_match git status --porcelain=v2 &&
295+
test_all_match git diff --staged --no-renames &&
296+
test_all_match git diff --staged --find-renames || return 1
297+
done
298+
'
299+
300+
test_expect_success 'diff with directory/file conflicts' '
301+
init_repos &&
302+
303+
for branch in rename-out-to-out rename-out-to-in rename-in-to-out
304+
do
305+
git -C full-checkout reset --hard &&
306+
test_sparse_match git reset --hard &&
307+
test_all_match git checkout $branch &&
308+
test_all_match git checkout rename-base -- . &&
309+
test_all_match git status --porcelain=v2 &&
272310
test_all_match git diff --staged --no-renames &&
273311
test_all_match git diff --staged --find-renames || return 1
274312
done

0 commit comments

Comments
 (0)