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>
Derrick Stolee committed
Jan 24, 2020 at 21:19 UTC
d622c34396b3ea1a81f07d951ee1112f83d9330c
1 file changed
+49
-49
t/t1091-sparse-checkout-builtin.sh
+49
-49
@@ -46,11 +46,11 @@ test_expect_success 'git sparse-checkout list (empty)' '
46
47
test_expect_success 'git sparse-checkout list (populated)' '
48
test_when_finished rm -f repo/.git/info/sparse-checkout &&
49
- cat >repo/.git/info/sparse-checkout <<-EOF &&
50
- /folder1/*
51
- /deep/
52
- **/a
53
- !*bin*
49
+ cat >repo/.git/info/sparse-checkout <<-\EOF &&
50
+ /folder1/*
51
+ /deep/
52
+ **/a
53
+ !*bin*
54
EOF
55
cp repo/.git/info/sparse-checkout expect &&
56
git -C repo sparse-checkout list >list &&
@@ -59,9 +59,9 @@ test_expect_success 'git sparse-checkout list (populated)' '
59
60
test_expect_success 'git sparse-checkout init' '
61
git -C repo sparse-checkout init &&
62
- cat >expect <<-EOF &&
63
- /*
64
- !/*/
62
+ cat >expect <<-\EOF &&
63
+ /*
64
+ !/*/
65
EOF
66
test_cmp expect repo/.git/info/sparse-checkout &&
67
test_cmp_config -C repo true core.sparsecheckout &&
@@ -70,9 +70,9 @@ test_expect_success 'git sparse-checkout init' '
70
71
test_expect_success 'git sparse-checkout list after init' '
72
git -C repo sparse-checkout list >actual &&
73
- cat >expect <<-EOF &&
74
- /*
75
- !/*/
73
+ cat >expect <<-\EOF &&
74
+ /*
75
+ !/*/
76
EOF
77
test_cmp expect actual
78
'
@@ -80,10 +80,10 @@ test_expect_success 'git sparse-checkout list after init' '
80
test_expect_success 'init with existing sparse-checkout' '
81
echo "*folder*" >> repo/.git/info/sparse-checkout &&
82
git -C repo sparse-checkout init &&
83
- cat >expect <<-EOF &&
84
- /*
85
- !/*/
86
- *folder*
83
+ cat >expect <<-\EOF &&
84
+ /*
85
+ !/*/
86
+ *folder*
87
EOF
88
test_cmp expect repo/.git/info/sparse-checkout &&
89
check_files repo a folder1 folder2
@@ -92,9 +92,9 @@ test_expect_success 'init with existing sparse-checkout' '
92
test_expect_success 'clone --sparse' '
93
git clone --sparse repo clone &&
94
git -C clone sparse-checkout list >actual &&
95
- cat >expect <<-EOF &&
96
- /*
97
- !/*/
95
+ cat >expect <<-\EOF &&
96
+ /*
97
+ !/*/
98
EOF
99
test_cmp expect actual &&
100
check_files clone a
@@ -116,10 +116,10 @@ test_expect_success 'set enables config' '
116
117
test_expect_success 'set sparse-checkout using builtin' '
118
git -C repo sparse-checkout set "/*" "!/*/" "*folder*" &&
119
- cat >expect <<-EOF &&
120
- /*
121
- !/*/
122
- *folder*
119
+ cat >expect <<-\EOF &&
120
+ /*
121
+ !/*/
122
+ *folder*
123
EOF
124
git -C repo sparse-checkout list >actual &&
125
test_cmp expect actual &&
@@ -128,11 +128,11 @@ test_expect_success 'set sparse-checkout using builtin' '
128
'
129
130
test_expect_success 'set sparse-checkout using --stdin' '
131
- cat >expect <<-EOF &&
132
- /*
133
- !/*/
134
- /folder1/
135
- /folder2/
131
+ cat >expect <<-\EOF &&
132
+ /*
133
+ !/*/
134
+ /folder1/
135
+ /folder2/
136
EOF
137
git -C repo sparse-checkout set --stdin <expect &&
138
git -C repo sparse-checkout list >actual &&
@@ -179,28 +179,28 @@ test_expect_success 'cone mode: init and set' '
179
check_files repo a deep &&
180
check_files repo/deep a deeper1 &&
181
check_files repo/deep/deeper1 a deepest &&
182
- cat >expect <<-EOF &&
183
- /*
184
- !/*/
185
- /deep/
186
- !/deep/*/
187
- /deep/deeper1/
188
- !/deep/deeper1/*/
189
- /deep/deeper1/deepest/
182
+ cat >expect <<-\EOF &&
183
+ /*
184
+ !/*/
185
+ /deep/
186
+ !/deep/*/
187
+ /deep/deeper1/
188
+ !/deep/deeper1/*/
189
+ /deep/deeper1/deepest/
190
EOF
191
test_cmp expect repo/.git/info/sparse-checkout &&
192
- git -C repo sparse-checkout set --stdin 2>err <<-EOF &&
193
- folder1
194
- folder2
192
+ git -C repo sparse-checkout set --stdin 2>err <<-\EOF &&
193
+ folder1
194
+ folder2
195
EOF
196
test_must_be_empty err &&
197
check_files repo a folder1 folder2
198
'
199
200
test_expect_success 'cone mode: list' '
201
- cat >expect <<-EOF &&
202
- folder1
203
- folder2
201
+ cat >expect <<-\EOF &&
202
+ folder1
203
+ folder2
204
EOF
205
git -C repo sparse-checkout set --stdin <expect &&
206
git -C repo sparse-checkout list >actual 2>err &&
@@ -211,10 +211,10 @@ test_expect_success 'cone mode: list' '
211
test_expect_success 'cone mode: set with nested folders' '
212
git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err &&
213
test_line_count = 0 err &&
214
- cat >expect <<-EOF &&
215
- /*
216
- !/*/
217
- /deep/
214
+ cat >expect <<-\EOF &&
215
+ /*
216
+ !/*/
217
+ /deep/
218
EOF
219
test_cmp repo/.git/info/sparse-checkout expect
220
'
@@ -271,10 +271,10 @@ test_expect_success 'sparse-checkout (init|set|disable) fails with dirty status'
271
test_expect_success 'cone mode: set with core.ignoreCase=true' '
272
git -C repo sparse-checkout init --cone &&
273
git -C repo -c core.ignoreCase=true sparse-checkout set folder1 &&
274
- cat >expect <<-EOF &&
275
- /*
276
- !/*/
277
- /folder1/
274
+ cat >expect <<-\EOF &&
275
+ /*
276
+ !/*/
277
+ /folder1/
278
EOF
279
test_cmp expect repo/.git/info/sparse-checkout &&
280
check_files repo a folder1