From: Patrick Steinhardt Date: Wed, 08 Jul 2026 06:41:52 GMT Subject: Re: [PATCH v2 09/11] odb/transaction: introduce ODB transaction flags Message-ID: In-Reply-To: <20260708041412.1157499-10-jltobler@gmail.com> On Tue, Jul 07, 2026 at 11:14:10PM -0500, Justin Tobler wrote: > diff --git a/object-file.c b/object-file.c > index 9b8ee6f36c..d95bdabba5 100644 > --- a/object-file.c > +++ b/object-file.c > @@ -1710,6 +1712,27 @@ int odb_transaction_files_begin(struct odb_source *source, > transaction->base.commit = odb_transaction_files_commit; > transaction->base.write_object_stream = odb_transaction_files_write_object_stream; > transaction->base.env = odb_transaction_files_env; > + > + transaction->prefix = "bulk-fsync"; > + if (flags & ODB_TRANSACTION_RECEIVE) { > + /* > + * ODB transactions for git-receive-pack(1) eagerly create a > + * temporary directory and use a different temporary directory > + * prefix. > + * > + * NEEDSWORK: This transaction flag is only used by the "files" > + * backend to special case temporary directory set up and > + * handling. Ideally transaction users should not have to care > + * though. To avoid this, we could eagerly create the temporary > + * directory and use the same prefix name for all transactions. > + */ Yup, agreed, thanks for noting this here. > diff --git a/odb/transaction.h b/odb/transaction.h > index 1c6c97a53e..b19f180aee 100644 > --- a/odb/transaction.h > +++ b/odb/transaction.h > @@ -4,7 +4,6 @@ > #include "git-compat-util.h" > #include "gettext.h" > #include "odb.h" > -#include "odb/source.h" This is curious, and likely a result of you adding "odb/transaction.h" to "odb/source.h". > @@ -45,6 +44,12 @@ struct odb_transaction { > int (*env)(struct odb_transaction *transaction, struct strvec *env); > }; > > +/* Flags used to configure an ODB transaction. */ > +enum odb_transaction_flags { > + /* Configures the transaction for use with git-receive-pack(1). */ > + ODB_TRANSACTION_RECEIVE = (1 << 0), > +}; > + > /* > * Starts an ODB transaction and returns it via `out`. Subsequent objects are > * written to the transaction and not committed until odb_transaction_commit() And this is the reason you have to add the include, so that the flags are visible in both "odb/source.h" and in "odb/transaction.h". This makes me wonder whether there's really much value in having this header here be split out of "odb/source.h". Patrick