]> git.ipfire.org Git - thirdparty/git.git/commit
refs: accept symref values in `ref_transaction_update()`
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 7 May 2024 12:58:52 +0000 (14:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 May 2024 15:51:49 +0000 (08:51 -0700)
commit1bc4cc3fc4276203e62de610a712c8ddea45b5cf
treefb840cc30e5e6043632e0987d2250c68cb6994d4
parent436d4e5b14df49870a897f64fe92c0ddc7017e4c
refs: accept symref values in `ref_transaction_update()`

The function `ref_transaction_update()` obtains ref information and
flags to create a `ref_update` and add them to the transaction at hand.

To extend symref support in transactions, we need to also accept the
old and new ref targets and process it. This commit adds the required
parameters to the function and modifies all call sites.

The two parameters added are `new_target` and `old_target`. The
`new_target` is used to denote what the reference should point to when
the transaction is applied. Some functions allow this parameter to be
NULL, meaning that the reference is not changed.

The `old_target` denotes the value the reference must have before the
update. Some functions allow this parameter to be NULL, meaning that the
old value of the reference is not checked.

We also update the internal function `ref_transaction_add_update()`
similarly to take the two new parameters.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 files changed:
branch.c
builtin/fast-import.c
builtin/fetch.c
builtin/receive-pack.c
builtin/replace.c
builtin/tag.c
builtin/update-ref.c
refs.c
refs.h
refs/files-backend.c
refs/refs-internal.h
refs/reftable-backend.c
sequencer.c
walker.c