Re: [PATCH 1/2] object-file: lift ODB reprepare out of packfile flush
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Sep 15, 2026, 08:54 UTC
- Message-ID
- <aqkGPcJdw3QagN0B@jtobler--20250820-SHC54>
- In-Reply-To
- <CAOLa=ZQBo5ZyHtx4yLvjJXzJYgGieeuX2g0mycPKOPt+VqJ93Q@mail.gmail.com>
On 26/09/15 12:40AM, Karthik Nayak wrote:
Show 17 quoted lines
>Justin Tobler <jltobler@gmail.com> writes:
>> @@ -1260,6 +1260,7 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
>> {
>> struct odb_transaction_files *transaction =
>> container_of(base, struct odb_transaction_files, base);
>> + int have_packfile = !!transaction->packfile.f;
>>
>> if (transaction->objdir) {
>> struct strbuf temp_path = STRBUF_INIT;
>> @@ -1293,6 +1294,9 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
>>
>> flush_packfile_transaction(transaction);
>>
>
>Earlier this would unconditionally call `odb_reprepare()` within, now we
>only call if needed. Which makes sense. Would it also make sense to only
>call `flush_packfile_transaction(transaction)` if we have a packfile?`flush_packfile_transaction()` already returns early if there is nothing to do. We could make it more explicit here, but I think it is probably fine to leave it as-is.
-Justin