t: convert some here-doc test bodies

The t1404 script checks a lot of output from Git which contains single quotes. Because the test snippets are themselves wrapped in the same single-quotes, we have to resort to using $SQ to match them. This is error-prone and makes the tests harder to read. Instead, let's use the new here-doc feature added in the previous commit, which lets us write anything in the test body we want (except the here-doc end marker on a line by itself, of course). Note that we do use "\" in our marker to avoid interpolation (which is the whole point). But we don't use "<<-", as we want to preserve whitespace in the snippet (and running with "-v" before and after shows that we produce the exact same output, except with the ugly $SQ references fixed). I just converted every test here, even though only some of them use $SQ. But it would be equally correct to mix-and-match styles if we don't mind the inconsistency. I've also converted a few tests in t0600 which were moved from t1404 (I had written this patch before they were moved, but it seemed worth porting over the changes rather than losing them). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 10, 2024 at 04:39 UTC f6b75726b2779faa57bd590deb882d3da157f3be
2 files changed +117 -117
t/t0600-reffiles-backend.sh
+19 -19
@@ -91,82 +91,82 @@ test_expect_success 'empty directory should not fool 1-arg delete' '
91 git update-ref --stdin
92 '
93
94 -test_expect_success 'non-empty directory blocks create' '
94 +test_expect_success 'non-empty directory blocks create' - <<\EOT
95 prefix=refs/ne-create &&
96 mkdir -p .git/$prefix/foo/bar &&
97 : >.git/$prefix/foo/bar/baz.lock &&
98 test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
99 cat >expected <<-EOF &&
100 - fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
100 + fatal: cannot lock ref '$prefix/foo': there is a non-empty directory '.git/$prefix/foo' blocking reference '$prefix/foo'
101 EOF
102 printf "%s\n" "update $prefix/foo $C" |
103 test_must_fail git update-ref --stdin 2>output.err &&
104 test_cmp expected output.err &&
105 cat >expected <<-EOF &&
106 - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ
106 + fatal: cannot lock ref '$prefix/foo': unable to resolve reference '$prefix/foo'
107 EOF
108 printf "%s\n" "update $prefix/foo $D $C" |
109 test_must_fail git update-ref --stdin 2>output.err &&
110 test_cmp expected output.err
111 -'
111 +EOT
112
113 -test_expect_success 'broken reference blocks create' '
113 +test_expect_success 'broken reference blocks create' - <<\EOT
114 prefix=refs/broken-create &&
115 mkdir -p .git/$prefix &&
116 echo "gobbledigook" >.git/$prefix/foo &&
117 test_when_finished "rm -f .git/$prefix/foo" &&
118 cat >expected <<-EOF &&
119 - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
119 + fatal: cannot lock ref '$prefix/foo': unable to resolve reference '$prefix/foo': reference broken
120 EOF
121 printf "%s\n" "update $prefix/foo $C" |
122 test_must_fail git update-ref --stdin 2>output.err &&
123 test_cmp expected output.err &&
124 cat >expected <<-EOF &&
125 - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
125 + fatal: cannot lock ref '$prefix/foo': unable to resolve reference '$prefix/foo': reference broken
126 EOF
127 printf "%s\n" "update $prefix/foo $D $C" |
128 test_must_fail git update-ref --stdin 2>output.err &&
129 test_cmp expected output.err
130 -'
130 +EOT
131
132 -test_expect_success 'non-empty directory blocks indirect create' '
132 +test_expect_success 'non-empty directory blocks indirect create' - <<\EOT
133 prefix=refs/ne-indirect-create &&
134 git symbolic-ref $prefix/symref $prefix/foo &&
135 mkdir -p .git/$prefix/foo/bar &&
136 : >.git/$prefix/foo/bar/baz.lock &&
137 test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
138 cat >expected <<-EOF &&
139 - fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
139 + fatal: cannot lock ref '$prefix/symref': there is a non-empty directory '.git/$prefix/foo' blocking reference '$prefix/foo'
140 EOF
141 printf "%s\n" "update $prefix/symref $C" |
142 test_must_fail git update-ref --stdin 2>output.err &&
143 test_cmp expected output.err &&
144 cat >expected <<-EOF &&
145 - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ
145 + fatal: cannot lock ref '$prefix/symref': unable to resolve reference '$prefix/foo'
146 EOF
147 printf "%s\n" "update $prefix/symref $D $C" |
148 test_must_fail git update-ref --stdin 2>output.err &&
149 test_cmp expected output.err
150 -'
150 +EOT
151
152 -test_expect_success 'broken reference blocks indirect create' '
152 +test_expect_success 'broken reference blocks indirect create' - <<\EOT
153 prefix=refs/broken-indirect-create &&
154 git symbolic-ref $prefix/symref $prefix/foo &&
155 echo "gobbledigook" >.git/$prefix/foo &&
156 test_when_finished "rm -f .git/$prefix/foo" &&
157 cat >expected <<-EOF &&
158 - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
158 + fatal: cannot lock ref '$prefix/symref': unable to resolve reference '$prefix/foo': reference broken
159 EOF
160 printf "%s\n" "update $prefix/symref $C" |
161 test_must_fail git update-ref --stdin 2>output.err &&
162 test_cmp expected output.err &&
163 cat >expected <<-EOF &&
164 - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
164 + fatal: cannot lock ref '$prefix/symref': unable to resolve reference '$prefix/foo': reference broken
165 EOF
166 printf "%s\n" "update $prefix/symref $D $C" |
167 test_must_fail git update-ref --stdin 2>output.err &&
168 test_cmp expected output.err
169 -'
169 +EOT
170
171 test_expect_success 'no bogus intermediate values during delete' '
172 prefix=refs/slow-transaction &&
@@ -224,7 +224,7 @@ test_expect_success 'no bogus intermediate values during delete' '
224 test_must_fail git rev-parse --verify --quiet $prefix/foo
225 '
226
227 -test_expect_success 'delete fails cleanly if packed-refs file is locked' '
227 +test_expect_success 'delete fails cleanly if packed-refs file is locked' - <<\EOT
228 prefix=refs/locked-packed-refs &&
229 # Set up a reference with differing loose and packed versions:
230 git update-ref $prefix/foo $C &&
@@ -236,9 +236,9 @@ test_expect_success 'delete fails cleanly if packed-refs file is locked' '
236 test_when_finished "rm -f .git/packed-refs.lock" &&
237 test_must_fail git update-ref -d $prefix/foo >out 2>err &&
238 git for-each-ref $prefix >actual &&
239 - test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err &&
239 + test_grep "Unable to create '.*packed-refs.lock': " err &&
240 test_cmp unchanged actual
241 -'
241 +EOT
242
243 test_expect_success 'delete fails cleanly if packed-refs.new write fails' '
244 # Setup and expectations are similar to the test above.
t/t1404-update-ref-errors.sh
+98 -98
@@ -100,13 +100,13 @@ df_test() {
100 printf "%s\n" "delete $delname" "create $addname $D"
101 fi >commands &&
102 test_must_fail git update-ref --stdin <commands 2>output.err &&
103 - grep -E "fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err &&
103 + grep -E "fatal:( cannot lock ref '$addname':)? '$delref' exists; cannot create '$addref'" output.err &&
104 printf "%s\n" "$C $delref" >expected-refs &&
105 git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
106 test_cmp expected-refs actual-refs
107 }
108
109 -test_expect_success 'setup' '
109 +test_expect_success 'setup' - <<\EOT
110
111 git commit --allow-empty -m Initial &&
112 C=$(git rev-parse HEAD) &&
@@ -114,283 +114,283 @@ test_expect_success 'setup' '
114 D=$(git rev-parse HEAD) &&
115 git commit --allow-empty -m Third &&
116 E=$(git rev-parse HEAD)
117 -'
117 +EOT
118
119 -test_expect_success 'existing loose ref is a simple prefix of new' '
119 +test_expect_success 'existing loose ref is a simple prefix of new' - <<\EOT
120
121 prefix=refs/1l &&
122 test_update_rejected "a c e" false "b c/x d" \
123 - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x$SQ"
123 + "'$prefix/c' exists; cannot create '$prefix/c/x'"
124
125 -'
125 +EOT
126
127 -test_expect_success 'existing packed ref is a simple prefix of new' '
127 +test_expect_success 'existing packed ref is a simple prefix of new' - <<\EOT
128
129 prefix=refs/1p &&
130 test_update_rejected "a c e" true "b c/x d" \
131 - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x$SQ"
131 + "'$prefix/c' exists; cannot create '$prefix/c/x'"
132
133 -'
133 +EOT
134
135 -test_expect_success 'existing loose ref is a deeper prefix of new' '
135 +test_expect_success 'existing loose ref is a deeper prefix of new' - <<\EOT
136
137 prefix=refs/2l &&
138 test_update_rejected "a c e" false "b c/x/y d" \
139 - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x/y$SQ"
139 + "'$prefix/c' exists; cannot create '$prefix/c/x/y'"
140
141 -'
141 +EOT
142
143 -test_expect_success 'existing packed ref is a deeper prefix of new' '
143 +test_expect_success 'existing packed ref is a deeper prefix of new' - <<\EOT
144
145 prefix=refs/2p &&
146 test_update_rejected "a c e" true "b c/x/y d" \
147 - "$SQ$prefix/c$SQ exists; cannot create $SQ$prefix/c/x/y$SQ"
147 + "'$prefix/c' exists; cannot create '$prefix/c/x/y'"
148
149 -'
149 +EOT
150
151 -test_expect_success 'new ref is a simple prefix of existing loose' '
151 +test_expect_success 'new ref is a simple prefix of existing loose' - <<\EOT
152
153 prefix=refs/3l &&
154 test_update_rejected "a c/x e" false "b c d" \
155 - "$SQ$prefix/c/x$SQ exists; cannot create $SQ$prefix/c$SQ"
155 + "'$prefix/c/x' exists; cannot create '$prefix/c'"
156
157 -'
157 +EOT
158
159 -test_expect_success 'new ref is a simple prefix of existing packed' '
159 +test_expect_success 'new ref is a simple prefix of existing packed' - <<\EOT
160
161 prefix=refs/3p &&
162 test_update_rejected "a c/x e" true "b c d" \
163 - "$SQ$prefix/c/x$SQ exists; cannot create $SQ$prefix/c$SQ"
163 + "'$prefix/c/x' exists; cannot create '$prefix/c'"
164
165 -'
165 +EOT
166
167 -test_expect_success 'new ref is a deeper prefix of existing loose' '
167 +test_expect_success 'new ref is a deeper prefix of existing loose' - <<\EOT
168
169 prefix=refs/4l &&
170 test_update_rejected "a c/x/y e" false "b c d" \
171 - "$SQ$prefix/c/x/y$SQ exists; cannot create $SQ$prefix/c$SQ"
171 + "'$prefix/c/x/y' exists; cannot create '$prefix/c'"
172
173 -'
173 +EOT
174
175 -test_expect_success 'new ref is a deeper prefix of existing packed' '
175 +test_expect_success 'new ref is a deeper prefix of existing packed' - <<\EOT
176
177 prefix=refs/4p &&
178 test_update_rejected "a c/x/y e" true "b c d" \
179 - "$SQ$prefix/c/x/y$SQ exists; cannot create $SQ$prefix/c$SQ"
179 + "'$prefix/c/x/y' exists; cannot create '$prefix/c'"
180
181 -'
181 +EOT
182
183 -test_expect_success 'one new ref is a simple prefix of another' '
183 +test_expect_success 'one new ref is a simple prefix of another' - <<\EOT
184
185 prefix=refs/5 &&
186 test_update_rejected "a e" false "b c c/x d" \
187 - "cannot process $SQ$prefix/c$SQ and $SQ$prefix/c/x$SQ at the same time"
187 + "cannot process '$prefix/c' and '$prefix/c/x' at the same time"
188
189 -'
189 +EOT
190
191 -test_expect_success 'D/F conflict prevents add long + delete short' '
191 +test_expect_success 'D/F conflict prevents add long + delete short' - <<\EOT
192 df_test refs/df-al-ds --add-del foo/bar foo
193 -'
193 +EOT
194
195 -test_expect_success 'D/F conflict prevents add short + delete long' '
195 +test_expect_success 'D/F conflict prevents add short + delete long' - <<\EOT
196 df_test refs/df-as-dl --add-del foo foo/bar
197 -'
197 +EOT
198
199 -test_expect_success 'D/F conflict prevents delete long + add short' '
199 +test_expect_success 'D/F conflict prevents delete long + add short' - <<\EOT
200 df_test refs/df-dl-as --del-add foo/bar foo
201 -'
201 +EOT
202
203 -test_expect_success 'D/F conflict prevents delete short + add long' '
203 +test_expect_success 'D/F conflict prevents delete short + add long' - <<\EOT
204 df_test refs/df-ds-al --del-add foo foo/bar
205 -'
205 +EOT
206
207 -test_expect_success 'D/F conflict prevents add long + delete short packed' '
207 +test_expect_success 'D/F conflict prevents add long + delete short packed' - <<\EOT
208 df_test refs/df-al-dsp --pack --add-del foo/bar foo
209 -'
209 +EOT
210
211 -test_expect_success 'D/F conflict prevents add short + delete long packed' '
211 +test_expect_success 'D/F conflict prevents add short + delete long packed' - <<\EOT
212 df_test refs/df-as-dlp --pack --add-del foo foo/bar
213 -'
213 +EOT
214
215 -test_expect_success 'D/F conflict prevents delete long packed + add short' '
215 +test_expect_success 'D/F conflict prevents delete long packed + add short' - <<\EOT
216 df_test refs/df-dlp-as --pack --del-add foo/bar foo
217 -'
217 +EOT
218
219 -test_expect_success 'D/F conflict prevents delete short packed + add long' '
219 +test_expect_success 'D/F conflict prevents delete short packed + add long' - <<\EOT
220 df_test refs/df-dsp-al --pack --del-add foo foo/bar
221 -'
221 +EOT
222
223 # Try some combinations involving symbolic refs...
224
225 -test_expect_success 'D/F conflict prevents indirect add long + delete short' '
225 +test_expect_success 'D/F conflict prevents indirect add long + delete short' - <<\EOT
226 df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
227 -'
227 +EOT
228
229 -test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '
229 +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' - <<\EOT
230 df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
231 -'
231 +EOT
232
233 -test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '
233 +test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' - <<\EOT
234 df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
235 -'
235 +EOT
236
237 -test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '
237 +test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' - <<\EOT
238 df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
239 -'
239 +EOT
240
241 -test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '
241 +test_expect_success 'D/F conflict prevents indirect add long + delete short packed' - <<\EOT
242 df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
243 -'
243 +EOT
244
245 -test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '
245 +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' - <<\EOT
246 df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
247 -'
247 +EOT
248
249 -test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '
249 +test_expect_success 'D/F conflict prevents add long + indirect delete short packed' - <<\EOT
250 df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
251 -'
251 +EOT
252
253 -test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '
253 +test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' - <<\EOT
254 df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
255 -'
255 +EOT
256
257 # Test various errors when reading the old values of references...
258
259 -test_expect_success 'missing old value blocks update' '
259 +test_expect_success 'missing old value blocks update' - <<\EOT
260 prefix=refs/missing-update &&
261 cat >expected <<-EOF &&
262 - fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ
262 + fatal: cannot lock ref '$prefix/foo': unable to resolve reference '$prefix/foo'
263 EOF
264 printf "%s\n" "update $prefix/foo $E $D" |
265 test_must_fail git update-ref --stdin 2>output.err &&
266 test_cmp expected output.err
267 -'
267 +EOT
268
269 -test_expect_success 'incorrect old value blocks update' '
269 +test_expect_success 'incorrect old value blocks update' - <<\EOT
270 prefix=refs/incorrect-update &&
271 git update-ref $prefix/foo $C &&
272 cat >expected <<-EOF &&
273 - fatal: cannot lock ref $SQ$prefix/foo$SQ: is at $C but expected $D
273 + fatal: cannot lock ref '$prefix/foo': is at $C but expected $D
274 EOF
275 printf "%s\n" "update $prefix/foo $E $D" |
276 test_must_fail git update-ref --stdin 2>output.err &&
277 test_cmp expected output.err
278 -'
278 +EOT
279
280 -test_expect_success 'existing old value blocks create' '
280 +test_expect_success 'existing old value blocks create' - <<\EOT
281 prefix=refs/existing-create &&
282 git update-ref $prefix/foo $C &&
283 cat >expected <<-EOF &&
284 - fatal: cannot lock ref $SQ$prefix/foo$SQ: reference already exists
284 + fatal: cannot lock ref '$prefix/foo': reference already exists
285 EOF
286 printf "%s\n" "create $prefix/foo $E" |
287 test_must_fail git update-ref --stdin 2>output.err &&
288 test_cmp expected output.err
289 -'
289 +EOT
290
291 -test_expect_success 'incorrect old value blocks delete' '
291 +test_expect_success 'incorrect old value blocks delete' - <<\EOT
292 prefix=refs/incorrect-delete &&
293 git update-ref $prefix/foo $C &&
294 cat >expected <<-EOF &&
295 - fatal: cannot lock ref $SQ$prefix/foo$SQ: is at $C but expected $D
295 + fatal: cannot lock ref '$prefix/foo': is at $C but expected $D
296 EOF
297 printf "%s\n" "delete $prefix/foo $D" |
298 test_must_fail git update-ref --stdin 2>output.err &&
299 test_cmp expected output.err
300 -'
300 +EOT
301
302 -test_expect_success 'missing old value blocks indirect update' '
302 +test_expect_success 'missing old value blocks indirect update' - <<\EOT
303 prefix=refs/missing-indirect-update &&
304 git symbolic-ref $prefix/symref $prefix/foo &&
305 cat >expected <<-EOF &&
306 - fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ
306 + fatal: cannot lock ref '$prefix/symref': unable to resolve reference '$prefix/foo'
307 EOF
308 printf "%s\n" "update $prefix/symref $E $D" |
309 test_must_fail git update-ref --stdin 2>output.err &&
310 test_cmp expected output.err
311 -'
311 +EOT
312
313 -test_expect_success 'incorrect old value blocks indirect update' '
313 +test_expect_success 'incorrect old value blocks indirect update' - <<\EOT
314 prefix=refs/incorrect-indirect-update &&
315 git symbolic-ref $prefix/symref $prefix/foo &&
316 git update-ref $prefix/foo $C &&
317 cat >expected <<-EOF &&
318 - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D
318 + fatal: cannot lock ref '$prefix/symref': is at $C but expected $D
319 EOF
320 printf "%s\n" "update $prefix/symref $E $D" |
321 test_must_fail git update-ref --stdin 2>output.err &&
322 test_cmp expected output.err
323 -'
323 +EOT
324
325 -test_expect_success 'existing old value blocks indirect create' '
325 +test_expect_success 'existing old value blocks indirect create' - <<\EOT
326 prefix=refs/existing-indirect-create &&
327 git symbolic-ref $prefix/symref $prefix/foo &&
328 git update-ref $prefix/foo $C &&
329 cat >expected <<-EOF &&
330 - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference already exists
330 + fatal: cannot lock ref '$prefix/symref': reference already exists
331 EOF
332 printf "%s\n" "create $prefix/symref $E" |
333 test_must_fail git update-ref --stdin 2>output.err &&
334 test_cmp expected output.err
335 -'
335 +EOT
336
337 -test_expect_success 'incorrect old value blocks indirect delete' '
337 +test_expect_success 'incorrect old value blocks indirect delete' - <<\EOT
338 prefix=refs/incorrect-indirect-delete &&
339 git symbolic-ref $prefix/symref $prefix/foo &&
340 git update-ref $prefix/foo $C &&
341 cat >expected <<-EOF &&
342 - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D
342 + fatal: cannot lock ref '$prefix/symref': is at $C but expected $D
343 EOF
344 printf "%s\n" "delete $prefix/symref $D" |
345 test_must_fail git update-ref --stdin 2>output.err &&
346 test_cmp expected output.err
347 -'
347 +EOT
348
349 -test_expect_success 'missing old value blocks indirect no-deref update' '
349 +test_expect_success 'missing old value blocks indirect no-deref update' - <<\EOT
350 prefix=refs/missing-noderef-update &&
351 git symbolic-ref $prefix/symref $prefix/foo &&
352 cat >expected <<-EOF &&
353 - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference is missing but expected $D
353 + fatal: cannot lock ref '$prefix/symref': reference is missing but expected $D
354 EOF
355 printf "%s\n" "option no-deref" "update $prefix/symref $E $D" |
356 test_must_fail git update-ref --stdin 2>output.err &&
357 test_cmp expected output.err
358 -'
358 +EOT
359
360 -test_expect_success 'incorrect old value blocks indirect no-deref update' '
360 +test_expect_success 'incorrect old value blocks indirect no-deref update' - <<\EOT
361 prefix=refs/incorrect-noderef-update &&
362 git symbolic-ref $prefix/symref $prefix/foo &&
363 git update-ref $prefix/foo $C &&
364 cat >expected <<-EOF &&
365 - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D
365 + fatal: cannot lock ref '$prefix/symref': is at $C but expected $D
366 EOF
367 printf "%s\n" "option no-deref" "update $prefix/symref $E $D" |
368 test_must_fail git update-ref --stdin 2>output.err &&
369 test_cmp expected output.err
370 -'
370 +EOT
371
372 -test_expect_success 'existing old value blocks indirect no-deref create' '
372 +test_expect_success 'existing old value blocks indirect no-deref create' - <<\EOT
373 prefix=refs/existing-noderef-create &&
374 git symbolic-ref $prefix/symref $prefix/foo &&
375 git update-ref $prefix/foo $C &&
376 cat >expected <<-EOF &&
377 - fatal: cannot lock ref $SQ$prefix/symref$SQ: reference already exists
377 + fatal: cannot lock ref '$prefix/symref': reference already exists
378 EOF
379 printf "%s\n" "option no-deref" "create $prefix/symref $E" |
380 test_must_fail git update-ref --stdin 2>output.err &&
381 test_cmp expected output.err
382 -'
382 +EOT
383
384 -test_expect_success 'incorrect old value blocks indirect no-deref delete' '
384 +test_expect_success 'incorrect old value blocks indirect no-deref delete' - <<\EOT
385 prefix=refs/incorrect-noderef-delete &&
386 git symbolic-ref $prefix/symref $prefix/foo &&
387 git update-ref $prefix/foo $C &&
388 cat >expected <<-EOF &&
389 - fatal: cannot lock ref $SQ$prefix/symref$SQ: is at $C but expected $D
389 + fatal: cannot lock ref '$prefix/symref': is at $C but expected $D
390 EOF
391 printf "%s\n" "option no-deref" "delete $prefix/symref $D" |
392 test_must_fail git update-ref --stdin 2>output.err &&
393 test_cmp expected output.err
394 -'
394 +EOT
395
396 test_done