Skip to content

Commit bb98703

Browse files
committed
Merge branch 'jt/tests-with-reftable'
Tweak a few tests not to manually modify the reference database (hence easier to work with other backends like reftable). * jt/tests-with-reftable: t5541: remove lockfile creation t1401: remove lockfile creation
2 parents bc554e6 + acf8ea2 commit bb98703

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

t/t1401-symbolic-ref.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ test_expect_success LONG_REF 'we can parse long symbolic ref' '
106106
'
107107

108108
test_expect_success 'symbolic-ref reports failure in exit code' '
109-
test_when_finished "rm -f .git/HEAD.lock" &&
110-
>.git/HEAD.lock &&
111-
test_must_fail git symbolic-ref HEAD refs/heads/whatever
109+
# Create d/f conflict to simulate failure.
110+
test_must_fail git symbolic-ref refs/heads refs/heads/foo
112111
'
113112

114113
test_expect_success 'symbolic-ref writes reflog entry' '

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)