Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-07-14 16:12:28 +0300
committerJunio C Hamano <gitster@pobox.com>2021-07-14 23:42:48 +0300
commite669ffb2b8f7effa4f6876f61c35ae5c4a8566b2 (patch)
tree30c26829925e349c2afe511a156ad9d8714be8fa /t/t1092-sparse-checkout-compatibility.sh
parent3d814b5dc0567ebca1c40c6fe10bd9f19ca31f58 (diff)
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 <newren@gmail.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1092-sparse-checkout-compatibility.sh')
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh44
1 files changed, 41 insertions, 3 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index ebbba044f7..0e71a62361 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -17,7 +17,7 @@ test_expect_success 'setup' '
echo "after folder1" >g &&
echo "after x" >z &&
mkdir folder1 folder2 deep x &&
- mkdir deep/deeper1 deep/deeper2 &&
+ mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
mkdir deep/deeper1/deepest &&
echo "after deeper1" >deep/e &&
echo "after deepest" >deep/deeper1/e &&
@@ -25,10 +25,23 @@ test_expect_success 'setup' '
cp a folder2 &&
cp a x &&
cp a deep &&
+ cp a deep/before &&
cp a deep/deeper1 &&
cp a deep/deeper2 &&
+ cp a deep/later &&
cp a deep/deeper1/deepest &&
cp -r deep/deeper1/deepest deep/deeper2 &&
+ mkdir deep/deeper1/0 &&
+ mkdir deep/deeper1/0/0 &&
+ touch deep/deeper1/0/1 &&
+ touch deep/deeper1/0/0/0 &&
+ >folder1- &&
+ >folder1.x &&
+ >folder10 &&
+ cp -r deep/deeper1/0 folder1 &&
+ cp -r deep/deeper1/0 folder2 &&
+ echo >>folder1/0/0/0 &&
+ echo >>folder2/0/1 &&
git add . &&
git commit -m "initial commit" &&
git checkout -b base &&
@@ -56,11 +69,17 @@ test_expect_success 'setup' '
mv folder1/a folder2/b &&
mv folder1/larger-content folder2/edited-content &&
echo >>folder2/edited-content &&
+ echo >>folder2/0/1 &&
+ echo stuff >>deep/deeper1/a &&
git add . &&
git commit -m "rename folder1/... to folder2/..." &&
git checkout -b rename-out-to-in rename-base &&
mv folder1/a deep/deeper1/b &&
+ echo more stuff >>deep/deeper1/a &&
+ rm folder2/0/1 &&
+ mkdir folder2/0/1 &&
+ echo >>folder2/0/1/1 &&
mv folder1/larger-content deep/deeper1/edited-content &&
echo >>deep/deeper1/edited-content &&
git add . &&
@@ -68,6 +87,9 @@ test_expect_success 'setup' '
git checkout -b rename-in-to-out rename-base &&
mv deep/deeper1/a folder1/b &&
+ echo >>folder2/0/1 &&
+ rm -rf folder1/0/0 &&
+ echo >>folder1/0/0 &&
mv deep/deeper1/larger-content folder1/edited-content &&
echo >>folder1/edited-content &&
git add . &&
@@ -262,13 +284,29 @@ test_expect_success 'diff --staged' '
test_all_match git diff --staged
'
-test_expect_success 'diff with renames' '
+test_expect_success 'diff with renames and conflicts' '
init_repos &&
for branch in rename-out-to-out rename-out-to-in rename-in-to-out
do
test_all_match git checkout rename-base &&
- test_all_match git checkout $branch -- .&&
+ test_all_match git checkout $branch -- . &&
+ test_all_match git status --porcelain=v2 &&
+ test_all_match git diff --staged --no-renames &&
+ test_all_match git diff --staged --find-renames || return 1
+ done
+'
+
+test_expect_success 'diff with directory/file conflicts' '
+ init_repos &&
+
+ for branch in rename-out-to-out rename-out-to-in rename-in-to-out
+ do
+ git -C full-checkout reset --hard &&
+ test_sparse_match git reset --hard &&
+ test_all_match git checkout $branch &&
+ test_all_match git checkout rename-base -- . &&
+ test_all_match git status --porcelain=v2 &&
test_all_match git diff --staged --no-renames &&
test_all_match git diff --staged --find-renames || return 1
done