summaryrefslogtreecommitdiff
path: root/t/t1091-sparse-checkout-builtin.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-03-27 00:48:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-27 18:33:30 (GMT)
commitf56f31af0301f6446f8689ba1a997d74fb82f45f (patch)
tree3aebd0beeaec2d800c2a2109881dac5069dc0010 /t/t1091-sparse-checkout-builtin.sh
parent7af7a25853cb87f34d192ba1d813ca09ee15d9f4 (diff)
downloadgit-f56f31af0301f6446f8689ba1a997d74fb82f45f.zip
git-f56f31af0301f6446f8689ba1a997d74fb82f45f.tar.gz
git-f56f31af0301f6446f8689ba1a997d74fb82f45f.tar.bz2
sparse-checkout: use new update_sparsity() function
Remove the equivalent of 'git read-tree -mu HEAD' in the sparse-checkout codepaths for setting the SKIP_WORKTREE bits and instead use the new update_sparsity() function. Note that when an issue is hit, the error message splits 'error' and 'Cannot update sparse checkout' on separate lines. For now, we use two greps to find both pieces of the error message but subsequent commits will clean up the messages reported to the user. Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1091-sparse-checkout-builtin.sh')
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh39
1 files changed, 29 insertions, 10 deletions
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 8607a8e..a991e0a 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -277,16 +277,23 @@ test_expect_success 'cone mode: add parent path' '
check_files repo a deep folder1
'
-test_expect_success 'revert to old sparse-checkout on bad update' '
+test_expect_success 'not-up-to-date does not block rest of sparsification' '
test_when_finished git -C repo sparse-checkout disable &&
test_when_finished git -C repo reset --hard &&
git -C repo sparse-checkout set deep &&
+
echo update >repo/deep/deeper2/a &&
cp repo/.git/info/sparse-checkout expect &&
- test_must_fail git -C repo sparse-checkout set deep/deeper1 2>err &&
- test_i18ngrep "cannot set sparse-checkout patterns" err &&
- test_cmp repo/.git/info/sparse-checkout expect &&
- check_files repo/deep a deeper1 deeper2
+ test_write_lines "!/deep/*/" "/deep/deeper1/" >>expect &&
+
+ git -C repo sparse-checkout set deep/deeper1 2>err &&
+
+ test_i18ngrep "Cannot update sparse checkout" err &&
+ test_cmp expect repo/.git/info/sparse-checkout &&
+ check_files repo/deep a deeper1 deeper2 &&
+ check_files repo/deep/deeper1 a deepest &&
+ check_files repo/deep/deeper1/deepest a &&
+ check_files repo/deep/deeper2 a
'
test_expect_success 'revert to old sparse-checkout on empty update' '
@@ -316,16 +323,28 @@ test_expect_success '.gitignore should not warn about cone mode' '
test_i18ngrep ! "disabling cone patterns" err
'
-test_expect_success 'sparse-checkout (init|set|disable) fails with dirty status' '
+test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' '
git clone repo dirty &&
echo dirty >dirty/folder1/a &&
- test_must_fail git -C dirty sparse-checkout init &&
- test_must_fail git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* &&
- test_must_fail git -C dirty sparse-checkout disable &&
+
+ git -C dirty sparse-checkout init 2>err &&
+ test_i18ngrep "error" err &&
+ test_i18ngrep "Cannot update sparse checkout" err &&
+
+ git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* 2>err &&
+ test_i18ngrep "error" err &&
+ test_i18ngrep "Cannot update sparse checkout" err &&
+ test_path_is_file dirty/folder1/a &&
+
+ git -C dirty sparse-checkout disable 2>err &&
+ test_must_be_empty err &&
+
git -C dirty reset --hard &&
git -C dirty sparse-checkout init &&
git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* &&
- git -C dirty sparse-checkout disable
+ test_path_is_missing dirty/folder1/a &&
+ git -C dirty sparse-checkout disable &&
+ test_path_is_file dirty/folder1/a
'
test_expect_success 'cone mode: set with core.ignoreCase=true' '