summaryrefslogtreecommitdiff
path: root/pseudo-merge.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-10-23 09:16:14 +0200
committerJunio C Hamano <gitster@pobox.com>2025-11-04 07:32:25 -0800
commitf89866163704528f1a6570e134853dbb99120e7c (patch)
tree33c9d1c9526a5e644b4a12c8a27ee8c932e3b426 /pseudo-merge.c
parenteb2934d94b43388642ce4840994800310a6d3456 (diff)
refs: expose peeled object ID via the iterator
Both the "files" and "reftable" backend are able to store peeled values for tags in the respective formats. This allows for a more efficient lookup of the target object of such a tag without having to manually peel via the object database. The infrastructure to access these peeled object IDs is somewhat funky though. When iterating through objects, we store a pointer reference to the current iterator in a global variable. The callbacks invoked by that iterator are then expected to call `peel_iterated_oid()`, which checks whether the globally-stored iterator's current reference refers to the one handed into that function. If so, we ask the iterator to peel the object, otherwise we manually peel the object via the object database. Depending on global state like this is somewhat weird and also quite fragile. Introduce a new `struct reference::peeled_oid` field that can be populated by the reference backends. This field can be accessed via a new function `reference_get_peeled_oid()` that either uses that value, if set, or alternatively peels via the ODB. With this change we don't have to rely on global state anymore, but make the peeled object ID available to the callback functions directly. Adjust trivial callers that already have a `struct reference` available. Remaining callers will be adjusted in subsequent commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pseudo-merge.c')
-rw-r--r--pseudo-merge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pseudo-merge.c b/pseudo-merge.c
index 0abd51b42c..a2d5bd85f9 100644
--- a/pseudo-merge.c
+++ b/pseudo-merge.c
@@ -230,7 +230,7 @@ static int find_pseudo_merge_group_for_ref(const struct reference *ref, void *_d
uint32_t i;
int has_bitmap;
- if (!peel_iterated_oid(the_repository, ref->oid, &peeled))
+ if (!reference_get_peeled_oid(the_repository, ref, &peeled))
maybe_peeled = &peeled;
c = lookup_commit(the_repository, maybe_peeled);