Hi, this small patch series contains a couple of improvements I required for libgit2. With those changes libgit2 is now able to run its full test suite with reftable-enabled repositories. I still need to invest a bit of work to make it memory-leak free and compile on Windows, but overall I think that support for reftables is almost ready. Changes in v2: - Another commit that fixes handling of outdated stacks when doing compaction. This issue is hit in libgit2, which has a test that performs writes with a couple dozen concurrent threads. - Add a link to past discussions around `{0}` vs `{{0}}` as provided by Eric. - Link to v1: https://lore.kernel.org/r/20250801-pks-reftable-fixes-for-libgit2-v1-0-f446e1c33cb9@xxxxxx Thanks! Patrick --- Patrick Steinhardt (6): reftable/writer: fix type used for number of records reftable/writer: drop Git-specific `QSORT()` macro reftable/stack: fix compiler warning due to missing braces reftable/stack: reorder code to avoid forward declarations reftable/stack: allow passing flags to `reftable_stack_add()` reftable/stack: handle outdated stacks when compacting refs/reftable-backend.c | 8 +- reftable/reftable-stack.h | 9 +- reftable/reftable-writer.h | 4 +- reftable/stack.c | 398 ++++++++++++++++++++-------------------- reftable/writer.c | 23 ++- t/unit-tests/t-reftable-stack.c | 50 ++--- 6 files changed, 253 insertions(+), 239 deletions(-) Range-diff versus v1: 1: e8aacccd51 = 1: c8bba1f88b reftable/writer: fix type used for number of records 2: b1a331bc78 = 2: 6c20e9a874 reftable/writer: drop Git-specific `QSORT()` macro 3: 1b3556685d ! 3: c2ed4eab6a reftable/stack: fix compiler warning due to missing braces @@ Commit message Silence this warning by using `{{0}}` instead. + Note that we had the discussion around whether or not we want to handle + such errors in the past already [1], where we basically decided that we + do not care about such old-and-buggy compilers. But the reftable library + is a special case because it is used by projects other than Git, and + libgit2 for example hits the above issue in its pipeline. As there is + only a single problematic instance of this issue we do the pragmatic + thing and simply make the compiler happy. + + [1]: https://lore.kernel.org/git/20220710081135.74964-1-sunshine@xxxxxxxxxxxxxx/T/ + Signed-off-by: Patrick Steinhardt <ps@xxxxxx> ## reftable/stack.c ## 4: c1fb437781 = 4: 0f1bb446ce reftable/stack: reorder code to avoid forward declarations 5: 33dcf7ca70 = 5: 5aaff713dd reftable/stack: allow passing flags to `reftable_stack_add()` -: ---------- > 6: ccfa5b59a0 reftable/stack: handle outdated stacks when compacting --- base-commit: e813a0200a7121b97fec535f0d0b460b0a33356c change-id: 20250801-pks-reftable-fixes-for-libgit2-562b959a5603