Subject: Re: [PATCH v3 4/7] object-file: remove flags from transaction packfile writes

From: Jeff King <[email-masked]>
Date: Mon, 6 Apr 2026 16:16:27 -0400

On Thu, Apr 02, 2026 at 04:32:17PM -0500, Justin Tobler wrote:

> @@ -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