From: Patrick Steinhardt Date: Wed, 08 Jul 2026 06:41:11 GMT Subject: Re: [PATCH v2 02/11] object-file: rename files transaction fsync function Message-ID: In-Reply-To: <20260708041412.1157499-3-jltobler@gmail.com> On Tue, Jul 07, 2026 at 11:14:03PM -0500, Justin Tobler wrote: > diff --git a/object-file.c b/object-file.c > index a3eb8d71dd..d68824bb44 100644 > --- a/object-file.c > +++ b/object-file.c > @@ -518,12 +518,17 @@ static void odb_transaction_files_prepare(struct odb_transaction *base) > tmp_objdir_replace_primary_odb(transaction->objdir, 0); > } > > -static void fsync_loose_object_transaction(struct odb_transaction *base, > - int fd, const char *filename) > +static void odb_transaction_files_fsync(struct odb_transaction *base, > + int fd, const char *filename) > { > struct odb_transaction_files *transaction = > container_of_or_null(base, struct odb_transaction_files, base); > > + if (!transaction || !transaction->objdir) { > + fsync_or_die(fd, filename); > + return; > + } The change results in a tiny bit of duplication, but I agree that it's easier to reason about. > @@ -531,8 +536,7 @@ static void fsync_loose_object_transaction(struct odb_transaction *base, Somewhat funny that the diff renderer decided to put the hunk header here instead of showing the single line that's now missing from the diff. > * before renaming the objects to their final names as part of > * flush_batch_fsync. > */ > - if (!transaction || !transaction->objdir || > - git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) { > + if (git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) { > if (errno == ENOSYS) > warning(_("core.fsyncMethod = batch is unsupported on this platform")); > fsync_or_die(fd, filename); Thanks! Patrick