summaryrefslogtreecommitdiff
path: root/t/t1416-ref-transaction-hooks.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1416-ref-transaction-hooks.sh')
-rwxr-xr-xt/t1416-ref-transaction-hooks.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t1416-ref-transaction-hooks.sh b/t/t1416-ref-transaction-hooks.sh
index da58d867a5..f6e741c6c0 100755
--- a/t/t1416-ref-transaction-hooks.sh
+++ b/t/t1416-ref-transaction-hooks.sh
@@ -7,6 +7,7 @@ test_description='reference transaction hooks'
test_expect_success setup '
mkdir -p .git/hooks &&
test_commit PRE &&
+ PRE_OID=$(git rev-parse PRE) &&
test_commit POST &&
POST_OID=$(git rev-parse POST)
'
@@ -106,4 +107,30 @@ test_expect_success 'hook gets all queued updates in aborted state' '
test_cmp expect actual
'
+test_expect_success 'interleaving hook calls succeed' '
+ test_when_finished "rm -r target-repo.git" &&
+
+ git init --bare target-repo.git &&
+
+ write_script target-repo.git/hooks/reference-transaction <<-\EOF &&
+ echo $0 "$@" >>actual
+ EOF
+
+ write_script target-repo.git/hooks/update <<-\EOF &&
+ echo $0 "$@" >>actual
+ EOF
+
+ cat >expect <<-EOF &&
+ hooks/update refs/tags/PRE $ZERO_OID $PRE_OID
+ hooks/reference-transaction prepared
+ hooks/reference-transaction committed
+ hooks/update refs/tags/POST $ZERO_OID $POST_OID
+ hooks/reference-transaction prepared
+ hooks/reference-transaction committed
+ EOF
+
+ git push ./target-repo.git PRE POST &&
+ test_cmp expect target-repo.git/actual
+'
+
test_done