summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2019-11-21 22:04:37 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-11-22 16:11:44 +0900
commit7bffca95ea1ca4f55663374ea9b929b9df5be04b (patch)
tree7a4895c16d6dfaf38faffce8220ecd34d0c1ac6c /t
parentsparse-checkout: 'set' subcommand (diff)
downloadtgif-7bffca95ea1ca4f55663374ea9b929b9df5be04b.tar.xz
sparse-checkout: add '--stdin' option to set subcommand
The 'git sparse-checkout set' subcommand takes a list of patterns and places them in the sparse-checkout file. Then, it updates the working directory to match those patterns. For a large list of patterns, the command-line call can get very cumbersome. Add a '--stdin' option to instead read patterns over standard in. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 72d8bc5c25..07e73b4674 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -128,4 +128,24 @@ test_expect_success 'set sparse-checkout using builtin' '
test_cmp expect dir
'
+test_expect_success 'set sparse-checkout using --stdin' '
+ cat >expect <<-EOF &&
+ /*
+ !/*/
+ /folder1/
+ /folder2/
+ EOF
+ git -C repo sparse-checkout set --stdin <expect &&
+ git -C repo sparse-checkout list >actual &&
+ test_cmp expect actual &&
+ test_cmp expect repo/.git/info/sparse-checkout &&
+ ls repo >dir &&
+ cat >expect <<-EOF &&
+ a
+ folder1
+ folder2
+ EOF
+ test_cmp expect dir
+'
+
test_done