t5541: remove lockfile creation
To create error conditions, some tests set up reference locks by directly creating its lockfile. While this works for the files reference backend, this approach is incompatible with the reftable backend. Refactor the test to create a d/f conflict via git-update-ref(1) instead so that the test is reference backend agnostic. Signed-off-by: Justin Tobler <jltobler@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Justin Tobler committed
Jan 11, 2024 at 20:24 UTC
acf8ea23afec3e42f0644dc1cdf66043b06bf3eb
1 file changed
+5
-13
t/t5541-http-push-smart.sh
+5
-13
@@ -232,8 +232,9 @@ test_expect_success 'push --atomic fails on server-side errors' '
232
test_config -C "$d" http.receivepack true &&
233
up="$HTTPD_URL"/smart/atomic-branches.git &&
234
235
- # break ref updates for other on the remote site
236
- mkdir "$d/refs/heads/other.lock" &&
235
+ # Create d/f conflict to break ref updates for other on the remote site.
236
+ git -C "$d" update-ref -d refs/heads/other &&
237
+ git -C "$d" update-ref refs/heads/other/conflict HEAD &&
238
239
# add the new commit to other
240
git branch -f other collateral &&
@@ -241,18 +242,9 @@ test_expect_success 'push --atomic fails on server-side errors' '
242
# --atomic should cause entire push to be rejected
243
test_must_fail git push --atomic "$up" atomic other 2>output &&
244
244
- # the new branch should not have been created upstream
245
- test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
246
-
247
- # upstream should still reflect atomic2, the last thing we pushed
248
- # successfully
249
- git rev-parse atomic2 >expected &&
250
- # ...to other.
251
- git -C "$d" rev-parse refs/heads/other >actual &&
252
- test_cmp expected actual &&
253
-
254
- # the new branch should not have been created upstream
245
+ # The atomic and other branches should not be created upstream.
246
test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
247
+ test_must_fail git -C "$d" show-ref --verify refs/heads/other &&
248
249
# the failed refs should be indicated to the user
250
grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&