Skip to content

Commit acf8ea2

Browse files
jltoblergitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a26f1fb commit acf8ea2

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

t/t5541-http-push-smart.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,27 +232,19 @@ test_expect_success 'push --atomic fails on server-side errors' '
232232
test_config -C "$d" http.receivepack true &&
233233
up="$HTTPD_URL"/smart/atomic-branches.git &&
234234
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 &&
237238
238239
# add the new commit to other
239240
git branch -f other collateral &&
240241
241242
# --atomic should cause entire push to be rejected
242243
test_must_fail git push --atomic "$up" atomic other 2>output &&
243244
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.
255246
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 &&
256248
257249
# the failed refs should be indicated to the user
258250
grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&

0 commit comments

Comments
 (0)