]> git.ipfire.org Git - thirdparty/git.git/commit
refs: introduce the `ref_transaction_update_reflog` function
authorKarthik Nayak <karthik.188@gmail.com>
Mon, 16 Dec 2024 16:44:31 +0000 (17:44 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Dec 2024 17:45:34 +0000 (09:45 -0800)
commit84675fa2717e08b39bf810eb9a439068ac915dfb
treedca887317d4699b844a946f8d725c1888c336fcc
parent4483be36f4477252f785df0c8c40677df8c18828
refs: introduce the `ref_transaction_update_reflog` function

Introduce a new function `ref_transaction_update_reflog`, for clients to
add a reflog update to a transaction. While the existing function
`ref_transaction_update` also allows clients to add a reflog entry, this
function does a few things more, It:
  - Enforces that only a reflog entry is added and does not update the
  ref itself.
  - Allows the users to also provide the committer information. This
  means clients can add reflog entries with custom committer
  information.

The `transaction_refname_valid()` function also modifies the error
message selectively based on the type of the update. This change also
affects reflog updates which go through `ref_transaction_update()`.

A follow up commit will utilize this function to add reflog support to
`git refs migrate`.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h
refs/files-backend.c