[PATCH 0/6] builtin/receive-pack: support pluggable packfile writes
Justin Tobler <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
Greetings, With bdee7b3013 (builtin/receive-pack: stage incoming objects via ODB transactions, 2026-07-10), git-receive-pack(1) started using the ODB transaction interfaces to stage incoming objects. While this brought the command closer to being ODB backend agnostic, the underlying git-index-pack(1) and git-unpack-objects(1) processes used to actually write the objects to the transaction are still fundamentally tied to the "files" backend. This series aims to address this by introducing a generic `odb_transaction_write_pack()` transaction interface to handle writing the incoming packfile to the transaction. The existing logic in git-receive-pack(1) that spawns the child processes to write the packfile becomes the "files" backend implementation of this interface. As part of this series, the first patch also introduces the `odb_transaction_release()` transaction interface. This is done to decouple freeing the transaction from committing it and is used later in the series to allow the post-commit cleanup of the ".keep" lockfile to be deffered until after references have been updated. I'm a bit uncertain as to whether the "release" part of the transaction lifecyle is really the appropriate spot for such logic though. An alternative could be to introduce a separate post-commit transaction interface that would exist to remove any lockfiles after reference updates have been performed. I am not certain such an explicit transaction interface is also the best route either. In this version, I've opted to keep it simple for now and tie the lockfile cleanup to transaction release, but I am open to change based on feedback. :) Most of the other patches are just structural refactorings to prepare git-receive-pack(1) to eventually use `odb_transaction_write_pack()`. The final patch makes the switch in git-receive-pack(1). Thanks for the review, -Justin Justin Tobler (6): odb/transaction: add transaction release interface builtin/receive-pack: pass shallow file explicitly builtin/receive-pack: lift global state out of unpack() builtin/receive-pack: report unpack errors via strbuf builtin/receive-pack: explicitly pass packfile fd odb/transaction: add transaction interface to write packfiles builtin/add.c | 3 +- builtin/receive-pack.c | 192 ++++++++++----------------------------- builtin/unpack-objects.c | 1 + builtin/update-index.c | 2 + cache-tree.c | 4 +- object-file.c | 153 ++++++++++++++++++++++++++++++- odb/transaction.c | 19 +++- odb/transaction.h | 77 ++++++++++++++++ read-cache.c | 4 +- 9 files changed, 305 insertions(+), 150 deletions(-) base-commit: 2c78326f810173a4f3aefd8021f1e07575412481 -- 2.55.0.424.g13c7afec21