]> git.ipfire.org Git - thirdparty/git.git/commit
bulk-checkin: require transaction for index_blob_bulk_checkin()
authorJustin Tobler <jltobler@gmail.com>
Fri, 22 Aug 2025 21:34:59 +0000 (16:34 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Aug 2025 16:48:13 +0000 (09:48 -0700)
commitaa4d81b53311fcdf099400beebad99c14be4b561
tree06f495fa5f97d208287aa21e0a62b1263c08e23b
parentb3361447256bb92a1dbdda910a33cfb1d6fc8f88
bulk-checkin: require transaction for index_blob_bulk_checkin()

The bulk-checkin subsystem provides a mechanism to write blobs directly
to a packfile via `index_blob_bulk_checkin()`. If there is an ongoing
transaction when invoked, objects written via this function are stored
in the same packfile. The packfile is not flushed until the transaction
itself is flushed. If there is no transaction, the single object is
written to a packfile and immediately flushed. This complicates
`index_blob_bulk_checkin()` as it cannot reliably use the provided
transaction to get the associated repository.

Update `index_blob_bulk_checkin()` to assume that a valid transaction is
always provided. Callers are now expected to ensure a transaction is set
up beforehand. With this simplification, `deflate_blob_bulk_checkin()`
is no longer needed as a standalone internal function and is combined
with `index_blob_bulk_checkin()`. The single call site in
`object-file.c:index_fd()` is updated accordingly. Due to how
`{begin,end}_odb_transaction()` handles nested transactions, a new
transaction is only created and committed if there is not already an
ongoing transaction.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bulk-checkin.c
bulk-checkin.h
object-file.c