Re: [PATCH v3 4/7] object-file: remove flags from transaction packfile writes
- From
Jeff King <peff@peff.net>
- Date
- Apr 6, 2026, 20:16 UTC
- Message-ID
- <20260406201627.GA26312@coredump.intra.peff.net>
- In-Reply-To
- <20260402213220.2651523-5-jltobler@gmail.com>
On Thu, Apr 02, 2026 at 04:32:17PM -0500, Justin Tobler wrote:
Show 24 quoted lines
> @@ -1667,18 +1685,28 @@ int index_fd(struct index_state *istate, struct object_id *oid,
> [...]
> + struct odb_write_stream stream;
> + odb_write_stream_from_fd(&stream, fd, xsize_t(st->st_size));
> +
> + if (flags & INDEX_WRITE_OBJECT) {
> + struct object_database *odb = the_repository->objects;
> + struct odb_transaction_files *files_transaction;
> + struct odb_transaction *transaction;
> +
> + transaction = odb_transaction_begin(odb);
> + files_transaction = container_of(odb->transaction,
> + struct odb_transaction_files,
> + base);
> + ret = index_blob_packfile_transaction(files_transaction, oid, fd,
> + xsize_t(st->st_size), path);
> + odb_transaction_commit(transaction);
> + } else {
> + ret = hash_blob_stream(&stream,
> + the_repository->hash_algo, oid,
> + xsize_t(st->st_size));
> + }
> +
> + odb_write_stream_release(&stream);Probably not a big deal, but I notice that "stream" is not used in half of the conditional. Should its initialization and cleanup be pushed down into the else clause?
-Peff