aboutsummaryrefslogtreecommitdiffstats
path: root/t/t1416-ref-transaction-hooks.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-20 11:20:04 -0700
committerJunio C Hamano <gitster@pobox.com>2024-05-20 11:20:04 -0700
commit4beb7a3b066c98d614d402aec32fc87d76206c89 (patch)
tree856e6ccd092b8b18c70868be74f70ee85be814e6 /t/t1416-ref-transaction-hooks.sh
parentd8ab1d464d07baa30e5a180eb33b3f9aa5c93adf (diff)
parent4865707bdae18163c215f2fa44c37388989bc0e4 (diff)
downloadgit-4beb7a3b066c98d614d402aec32fc87d76206c89.tar.gz
Merge branch 'kn/ref-transaction-symref'
Updates to symbolic refs can now be made as a part of ref transaction. * kn/ref-transaction-symref: refs: remove `create_symref` and associated dead code refs: rename `refs_create_symref()` to `refs_update_symref()` refs: use transaction in `refs_create_symref()` refs: add support for transactional symref updates refs: move `original_update_refname` to 'refs.c' refs: support symrefs in 'reference-transaction' hook files-backend: extract out `create_symref_lock()` refs: accept symref values in `ref_transaction_update()`
Diffstat (limited to 't/t1416-ref-transaction-hooks.sh')
-rwxr-xr-xt/t1416-ref-transaction-hooks.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t1416-ref-transaction-hooks.sh b/t/t1416-ref-transaction-hooks.sh
index 2092488090..067fd57290 100755
--- a/t/t1416-ref-transaction-hooks.sh
+++ b/t/t1416-ref-transaction-hooks.sh
@@ -134,4 +134,27 @@ test_expect_success 'interleaving hook calls succeed' '
test_cmp expect target-repo.git/actual
'
+test_expect_success 'hook captures git-symbolic-ref updates' '
+ test_when_finished "rm actual" &&
+
+ test_hook reference-transaction <<-\EOF &&
+ echo "$*" >>actual
+ while read -r line
+ do
+ printf "%s\n" "$line"
+ done >>actual
+ EOF
+
+ git symbolic-ref refs/heads/symref refs/heads/main &&
+
+ cat >expect <<-EOF &&
+ prepared
+ $ZERO_OID ref:refs/heads/main refs/heads/symref
+ committed
+ $ZERO_OID ref:refs/heads/main refs/heads/symref
+ EOF
+
+ test_cmp expect actual
+'
+
test_done