[PATCH 0/8] refs: move some of the generic logic out of the backends
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Apr 20, 2026, 10:11 UTC
- Message-ID
- <20260420-refs-move-to-generic-layer-v1-0-513e354f376b@gmail.com>
This series came together while I was working on other reference related code and realized that some of the individual logic implemented with the reference backends can be moved to the generic layer.
Moving code to the generic layer, simplifies the responsibility of individual backends and avoids deviation in logic between the backends.
The biggest changes are related to moving out usage of `parse_object()` and `peel_object()` from reference transactions. The former is used to validate that the OID provided points to a commit object. The latter is an optimization technique where the packed/reftable backend store the peeled OID whenever available, so reading such references provides the peeled OID without having to call the ODB.
Moving object parsing to the generic layout involves moving it out of the prepare stage of the transaction and into `ref_transaction_update()` where every added update is checked. As such, this also involves modifying update-ref(1) and receive-pack(1) to follow this paradigm.
--- builtin/receive-pack.c | 22 +++++--- builtin/update-ref.c | 143 ++++++++++++++++++++++++++++++------------------ refs.c | 60 +++++++++++++++----- refs.h | 16 +++--- refs/files-backend.c | 58 +++++++------------- refs/packed-backend.c | 10 ++-- refs/packed-backend.h | 3 +- refs/refs-internal.h | 35 ++++++++++-- refs/reftable-backend.c | 40 +++----------- 9 files changed, 223 insertions(+), 164 deletions(-)
Karthik Nayak (8):
refs: remove unused typedef 'ref_transaction_commit_fn'
refs: extract out reflog config to generic layer
refs: return `ref_transaction_error` from `ref_transaction_update()`
update-ref: move `print_rejected_refs()` up
update-ref: handle rejections while adding updates
refs: move object parsing to the generic layer
refs: add peeled object ID to the `ref_update` struct
refs: use peeled tag values in reference backendsbase-commit: f65aba1e87db64413b6d1ed5ae5a45b5a84a0997 change-id: 20260417-refs-move-to-generic-layer-f7525c5e8764
Thanks - Karthik