]> git.ipfire.org Git - thirdparty/git.git/commit
reftable: split up write options
authorPatrick Steinhardt <ps@pks.im>
Thu, 25 Jun 2026 09:20:07 +0000 (11:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jun 2026 20:19:58 +0000 (13:19 -0700)
commit992fccf050f5217bc6a8af98bd4740313ac55b62
treef7112af9c5a51b4d19c2473ac07950e8ab3f8dac
parent5b450e45b2f10f68e0c1e3954f1d05e7158a52ab
reftable: split up write options

When initializing the reftable stack the caller may optionally pass some
write options. These write options mix up two different concerns though:

  - Of course, they allow the caller to configure how new reftables are
    being written.

  - But they also allow the caller to configure the stack itself, like
    its hash ID and the `on_reload` callback.

This is somewhat awkward, as it doesn't easily give the caller the
flexibility to for example write multiple reftables with different
options. Furthermore, this requires us to eagerly parse relevant
configuration when initializing the reftable backend.

Refactor the code by splitting out those options that configure the
stack itself. Creating a new stack will thus only require this limited
set of options, whereas the caller is expected to pass write options to
all functions that end up writing tables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 files changed:
refs/reftable-backend.c
reftable/reftable-stack.h
reftable/reftable-writer.h
reftable/stack.c
reftable/stack.h
reftable/writer.c
reftable/writer.h
t/helper/test-reftable.c
t/unit-tests/lib-reftable.c
t/unit-tests/lib-reftable.h
t/unit-tests/u-reftable-merged.c
t/unit-tests/u-reftable-readwrite.c
t/unit-tests/u-reftable-stack.c
t/unit-tests/u-reftable-table.c