t1091: improve here-docs

t1091-sparse-checkout-builtin.sh uses here-docs to populate the
expected contents of the sparse-checkout file. These do not use
shell interpolation, so use "-\EOF" instead of "-EOF". Also use
proper tabbing.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee 2020-01-24 21:19:32 +00:00 committed by Junio C Hamano
parent 522e641748
commit d622c34396

View file

@ -46,11 +46,11 @@ test_expect_success 'git sparse-checkout list (empty)' '
test_expect_success 'git sparse-checkout list (populated)' ' test_expect_success 'git sparse-checkout list (populated)' '
test_when_finished rm -f repo/.git/info/sparse-checkout && test_when_finished rm -f repo/.git/info/sparse-checkout &&
cat >repo/.git/info/sparse-checkout <<-EOF && cat >repo/.git/info/sparse-checkout <<-\EOF &&
/folder1/* /folder1/*
/deep/ /deep/
**/a **/a
!*bin* !*bin*
EOF EOF
cp repo/.git/info/sparse-checkout expect && cp repo/.git/info/sparse-checkout expect &&
git -C repo sparse-checkout list >list && git -C repo sparse-checkout list >list &&
@ -59,9 +59,9 @@ test_expect_success 'git sparse-checkout list (populated)' '
test_expect_success 'git sparse-checkout init' ' test_expect_success 'git sparse-checkout init' '
git -C repo sparse-checkout init && git -C repo sparse-checkout init &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
EOF EOF
test_cmp expect repo/.git/info/sparse-checkout && test_cmp expect repo/.git/info/sparse-checkout &&
test_cmp_config -C repo true core.sparsecheckout && test_cmp_config -C repo true core.sparsecheckout &&
@ -70,9 +70,9 @@ test_expect_success 'git sparse-checkout init' '
test_expect_success 'git sparse-checkout list after init' ' test_expect_success 'git sparse-checkout list after init' '
git -C repo sparse-checkout list >actual && git -C repo sparse-checkout list >actual &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
EOF EOF
test_cmp expect actual test_cmp expect actual
' '
@ -80,10 +80,10 @@ test_expect_success 'git sparse-checkout list after init' '
test_expect_success 'init with existing sparse-checkout' ' test_expect_success 'init with existing sparse-checkout' '
echo "*folder*" >> repo/.git/info/sparse-checkout && echo "*folder*" >> repo/.git/info/sparse-checkout &&
git -C repo sparse-checkout init && git -C repo sparse-checkout init &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
*folder* *folder*
EOF EOF
test_cmp expect repo/.git/info/sparse-checkout && test_cmp expect repo/.git/info/sparse-checkout &&
check_files repo a folder1 folder2 check_files repo a folder1 folder2
@ -92,9 +92,9 @@ test_expect_success 'init with existing sparse-checkout' '
test_expect_success 'clone --sparse' ' test_expect_success 'clone --sparse' '
git clone --sparse repo clone && git clone --sparse repo clone &&
git -C clone sparse-checkout list >actual && git -C clone sparse-checkout list >actual &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
EOF EOF
test_cmp expect actual && test_cmp expect actual &&
check_files clone a check_files clone a
@ -116,10 +116,10 @@ test_expect_success 'set enables config' '
test_expect_success 'set sparse-checkout using builtin' ' test_expect_success 'set sparse-checkout using builtin' '
git -C repo sparse-checkout set "/*" "!/*/" "*folder*" && git -C repo sparse-checkout set "/*" "!/*/" "*folder*" &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
*folder* *folder*
EOF EOF
git -C repo sparse-checkout list >actual && git -C repo sparse-checkout list >actual &&
test_cmp expect actual && test_cmp expect actual &&
@ -128,11 +128,11 @@ test_expect_success 'set sparse-checkout using builtin' '
' '
test_expect_success 'set sparse-checkout using --stdin' ' test_expect_success 'set sparse-checkout using --stdin' '
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
/folder1/ /folder1/
/folder2/ /folder2/
EOF EOF
git -C repo sparse-checkout set --stdin <expect && git -C repo sparse-checkout set --stdin <expect &&
git -C repo sparse-checkout list >actual && git -C repo sparse-checkout list >actual &&
@ -179,28 +179,28 @@ test_expect_success 'cone mode: init and set' '
check_files repo a deep && check_files repo a deep &&
check_files repo/deep a deeper1 && check_files repo/deep a deeper1 &&
check_files repo/deep/deeper1 a deepest && check_files repo/deep/deeper1 a deepest &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
/deep/ /deep/
!/deep/*/ !/deep/*/
/deep/deeper1/ /deep/deeper1/
!/deep/deeper1/*/ !/deep/deeper1/*/
/deep/deeper1/deepest/ /deep/deeper1/deepest/
EOF EOF
test_cmp expect repo/.git/info/sparse-checkout && test_cmp expect repo/.git/info/sparse-checkout &&
git -C repo sparse-checkout set --stdin 2>err <<-EOF && git -C repo sparse-checkout set --stdin 2>err <<-\EOF &&
folder1 folder1
folder2 folder2
EOF EOF
test_must_be_empty err && test_must_be_empty err &&
check_files repo a folder1 folder2 check_files repo a folder1 folder2
' '
test_expect_success 'cone mode: list' ' test_expect_success 'cone mode: list' '
cat >expect <<-EOF && cat >expect <<-\EOF &&
folder1 folder1
folder2 folder2
EOF EOF
git -C repo sparse-checkout set --stdin <expect && git -C repo sparse-checkout set --stdin <expect &&
git -C repo sparse-checkout list >actual 2>err && git -C repo sparse-checkout list >actual 2>err &&
@ -211,10 +211,10 @@ test_expect_success 'cone mode: list' '
test_expect_success 'cone mode: set with nested folders' ' test_expect_success 'cone mode: set with nested folders' '
git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err && git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err &&
test_line_count = 0 err && test_line_count = 0 err &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
/deep/ /deep/
EOF EOF
test_cmp repo/.git/info/sparse-checkout expect test_cmp repo/.git/info/sparse-checkout expect
' '
@ -271,10 +271,10 @@ test_expect_success 'sparse-checkout (init|set|disable) fails with dirty status'
test_expect_success 'cone mode: set with core.ignoreCase=true' ' test_expect_success 'cone mode: set with core.ignoreCase=true' '
git -C repo sparse-checkout init --cone && git -C repo sparse-checkout init --cone &&
git -C repo -c core.ignoreCase=true sparse-checkout set folder1 && git -C repo -c core.ignoreCase=true sparse-checkout set folder1 &&
cat >expect <<-EOF && cat >expect <<-\EOF &&
/* /*
!/*/ !/*/
/folder1/ /folder1/
EOF EOF
test_cmp expect repo/.git/info/sparse-checkout && test_cmp expect repo/.git/info/sparse-checkout &&
check_files repo a folder1 check_files repo a folder1