Re: [PATCH 2/6] builtin/update-index: end ODB transaction when --verbose is specified
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 11, 2025, 06:40 UTC
- Message-ID
- <aMJu7vPKfnxt9UiC@pks.im>
- In-Reply-To
- <20250909191134.555689-3-jltobler@gmail.com>
On Tue, Sep 09, 2025 at 02:11:30PM -0500, Justin Tobler wrote:
Show 21 quoted lines
> With 23a3a303 (update-index: use the bulk-checkin infrastructure, > 2022-04-04), object database transactions were added to > git-update-index(1) to facilitate writing objects in bulk. With > transactions, newly added objects are instead written to a temporary > object directory and migrated to the primary object database upon > transaction commit. > > When the --verbose option is specified, each individual object is > explicitly flushed via flush_odb_transaction() prior to reporting the > update. Flushing the object database transaction migrates pending > objects to the primary object database without marking the transaction > as complete. This is done so objects are immediately visible to > git-update-index(1) callers using the --verbose option and that rely on > parsing verbose output to know when objects are written. > > As soon as verbose output is requested in git-update-index(1), all > subsequent object writes are flushed prior to being reported and thus no > longer benefit from being transactional. Furthermore, the mechanism to > flush a transaction without committing is rather awkward. Drop the call > to flush_odb_transaction() in favor of ending the transaction early when > the --verbose flag is encountered.
Okay, this interface feels somewhat weird indeed. If we now end the transaction early, does the transaction still serve any purpose at all? Like, do we use it to batch steps _before_ we start reporting stuff?
If the answer is "no", we might be able to just not create a transaction altogether. If the answer is "yes" we should probably point out in the commit message that the transaction still has a purpose.
Patrick