Skip to content

Commit

Permalink
t5541: generalize reference locking
Browse files Browse the repository at this point in the history
Some tests set up reference locks by directly creating the lockfile.
While this works for the files reference backend, reftable reference
locks operate differently and are incompatible with this approach.
Generalize reference locking by preparing a reference transaction.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
  • Loading branch information
jltobler committed Jan 9, 2024
1 parent 7aa9443 commit a4a2f36
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions t/t5541-http-push-smart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,29 @@ test_expect_success 'push --atomic fails on server-side errors' '
test_config -C "$d" http.receivepack true &&
up="$HTTPD_URL"/smart/atomic-branches.git &&
# break ref updates for other on the remote site
mkdir "$d/refs/heads/other.lock" &&
mkfifo in out &&
(git -C "$d" update-ref --stdin <in >out &) &&
exec 9>in &&
exec 8<out &&
test_when_finished "exec 9>&-" &&
test_when_finished "exec 8<&-" &&
echo "start" >&9 &&
echo "start: ok" >expected &&
read line <&8 &&
echo "$line" >actual &&
test_cmp expected actual &&
echo "update refs/heads/other refs/heads/other" >&9 &&
# Prepare reference transaction on `other` reference to lock it and thus
# break updates on the remote.
echo "prepare" >&9 &&
echo "prepare: ok" >expected &&
read line <&8 &&
echo "$line" >actual &&
test_cmp expected actual &&
# add the new commit to other
git branch -f other collateral &&
Expand Down

0 comments on commit a4a2f36

Please sign in to comment.