]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1091: improve here-docs
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 24 Jan 2020 21:19:32 +0000 (21:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jan 2020 21:26:54 +0000 (13:26 -0800)
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>
t/t1091-sparse-checkout-builtin.sh

index e058a20ad6c85d4c4d16519730fe84c49b8e0e33..e28e1c797f943296b63dfd5ffe3b6c311bb74a21 100755 (executable)
@@ -46,11 +46,11 @@ test_expect_success 'git sparse-checkout list (empty)' '
 
 test_expect_success 'git sparse-checkout list (populated)' '
        test_when_finished rm -f repo/.git/info/sparse-checkout &&
-       cat >repo/.git/info/sparse-checkout <<-EOF &&
-               /folder1/*
-               /deep/
-               **/a
-               !*bin*
+       cat >repo/.git/info/sparse-checkout <<-\EOF &&
+       /folder1/*
+       /deep/
+       **/a
+       !*bin*
        EOF
        cp repo/.git/info/sparse-checkout expect &&
        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' '
        git -C repo sparse-checkout init &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
        EOF
        test_cmp expect repo/.git/info/sparse-checkout &&
        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' '
        git -C repo sparse-checkout list >actual &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
        EOF
        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' '
        echo "*folder*" >> repo/.git/info/sparse-checkout &&
        git -C repo sparse-checkout init &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               *folder*
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       *folder*
        EOF
        test_cmp expect repo/.git/info/sparse-checkout &&
        check_files repo a folder1 folder2
@@ -92,9 +92,9 @@ test_expect_success 'init with existing sparse-checkout' '
 test_expect_success 'clone --sparse' '
        git clone --sparse repo clone &&
        git -C clone sparse-checkout list >actual &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
        EOF
        test_cmp expect actual &&
        check_files clone a
@@ -116,10 +116,10 @@ test_expect_success 'set enables config' '
 
 test_expect_success 'set sparse-checkout using builtin' '
        git -C repo sparse-checkout set "/*" "!/*/" "*folder*" &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               *folder*
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       *folder*
        EOF
        git -C repo sparse-checkout list >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' '
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               /folder1/
-               /folder2/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       /folder1/
+       /folder2/
        EOF
        git -C repo sparse-checkout set --stdin <expect &&
        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/deep a deeper1 &&
        check_files repo/deep/deeper1 a deepest &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               /deep/
-               !/deep/*/
-               /deep/deeper1/
-               !/deep/deeper1/*/
-               /deep/deeper1/deepest/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       /deep/
+       !/deep/*/
+       /deep/deeper1/
+       !/deep/deeper1/*/
+       /deep/deeper1/deepest/
        EOF
        test_cmp expect repo/.git/info/sparse-checkout &&
-       git -C repo sparse-checkout set --stdin 2>err <<-EOF &&
-               folder1
-               folder2
+       git -C repo sparse-checkout set --stdin 2>err <<-\EOF &&
+       folder1
+       folder2
        EOF
        test_must_be_empty err &&
        check_files repo a folder1 folder2
 '
 
 test_expect_success 'cone mode: list' '
-       cat >expect <<-EOF &&
-               folder1
-               folder2
+       cat >expect <<-\EOF &&
+       folder1
+       folder2
        EOF
        git -C repo sparse-checkout set --stdin <expect &&
        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' '
        git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err &&
        test_line_count = 0 err &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               /deep/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       /deep/
        EOF
        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' '
        git -C repo sparse-checkout init --cone &&
        git -C repo -c core.ignoreCase=true sparse-checkout set folder1 &&
-       cat >expect <<-EOF &&
-               /*
-               !/*/
-               /folder1/
+       cat >expect <<-\EOF &&
+       /*
+       !/*/
+       /folder1/
        EOF
        test_cmp expect repo/.git/info/sparse-checkout &&
        check_files repo a folder1