]> git.ipfire.org Git - thirdparty/git.git/commit
refs: add peeled object ID to the `ref_update` struct
authorKarthik Nayak <karthik.188@gmail.com>
Mon, 4 May 2026 17:44:12 +0000 (19:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 May 2026 07:34:08 +0000 (16:34 +0900)
commitad0f76d7824558e08cc35f77df2fc0e48ee1b28b
tree58b48482410480f7c2cd2c8e336254221f1027b0
parentb32c23be3bf444ad8d56e8daee4a704ff8cae0ea
refs: add peeled object ID to the `ref_update` struct

Certain reference backends {packed, reftable}, have the ability to also
store the peeled object ID for a reference pointing to a tag object.
This has the added benefit that during retrieval of such references, we
also obtain the peeled object ID without having to use the ODB.

To provide this functionality, each backend independently calls the ODB
to obtain the peeled OID. To move this functionality to the generic
layer, there must be support infrastructure to pass in a peeled OID for
reference updates.

Add a `peeled` field to the `ref_update` structure and modify
`ref_transaction_add_update()` to receive and copy this object ID to the
`ref_update` structure. Finally, modify `ref_transaction_update()` to
peel tag objects and pass the peeled OID to
`ref_transaction_add_update()`.

Update all callers of these functions with the new function parameters.
Callers which only add reflog updates, need to only pass in NULL, since
for reflogs, we don't store peeled OIDs. Reference deletions also only
need to pass in NULL. For others, pass along the peeled OID if
available.

In a following commit, we'll modify the backends to use this peeled OID
instead of parsing it themselves.

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