]> git.ipfire.org Git - thirdparty/git.git/commit
update-ref: add support for 'symref-verify' command
authorKarthik Nayak <karthik.188@gmail.com>
Fri, 7 Jun 2024 13:33:00 +0000 (15:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Jun 2024 17:25:44 +0000 (10:25 -0700)
commit1451ac734ffc1b9c45af12a2485c6d2ee69a6a76
treeba463011bb620635c1710b54f453346c05c25cef
parentaa6e99f1226fe46f1649f48d020011e19556e8e1
update-ref: add support for 'symref-verify' command

The 'symref-verify' command allows users to verify if a provided <ref>
contains the provided <old-target> without changing the <ref>. If
<old-target> is not provided, the command will verify that the <ref>
doesn't exist.

The command allows users to verify symbolic refs within a transaction,
and this means users can perform a set of changes in a transaction only
when the verification holds good.

Since we're checking for symbolic refs, this command will only work with
the 'no-deref' mode. This is because any dereferenced symbolic ref will
point to an object and not a ref and the regular 'verify' command can be
used in such situations.

Add required tests for symref support in 'verify'. Since we're here,
also add reflog checks for the pre-existing 'verify' tests, there is no
divergence from behavior, but we never tested to ensure that reflog
wasn't affected by the 'verify' command.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-update-ref.txt
builtin/update-ref.c
refs.c
refs.h
t/t1400-update-ref.sh
t/t1416-ref-transaction-hooks.sh