]> git.ipfire.org Git - thirdparty/git.git/commit
refs/reftable: handle reloading stacks in the reftable backend
authorPatrick Steinhardt <ps@pks.im>
Tue, 26 Nov 2024 06:42:53 +0000 (07:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Nov 2024 08:18:36 +0000 (17:18 +0900)
commit46b5f67019bbf9864416d13693f6292bca62d7af
tree6be1d1246f4b3030c13139ae1ad85056d970bf00
parentad0986c6764eed4dd9f0302aa3b1c5367e5c16a3
refs/reftable: handle reloading stacks in the reftable backend

When accessing a stack we almost always have to reload the stack before
reading data from it. This is mostly because Git does not have a
notification mechanism for when underlying data has been changed, and
thus we are forced to opportunistically reload the stack every single
time to account for any changes that may have happened concurrently.

Handle the reload internally in `backend_for()`. For one this forces
callsites to think about whether or not they need to reload the stack.
But second this makes the logic to access stacks more self-contained by
letting the `struct reftable_backend` manage themselves.

Update callsites where we don't reload the stack to document why we
don't. In some cases it's unclear whether it is the right thing to do in
the first place, but fixing that is outside of the scope of this patch
series.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/reftable-backend.c