From: Karthik Nayak Date: Mon, 26 Oct 2026 21:51:47 GMT Subject: Re: [PATCH v4 3/4] object-file: explicitly write ".keep" lockfile Message-ID: In-Reply-To: <20261021182528.3055494-4-jltobler@gmail.com> Justin Tobler writes: [snip] > diff --git a/object-file.c b/object-file.c > index 210984f825..74a31760bc 100644 > --- a/object-file.c > +++ b/object-file.c > @@ -1424,34 +1464,57 @@ static int odb_transaction_files_write_pack(struct odb_transaction *base, > return -1; > } > > - /* > - * The lockfile filepath is expected to be the final location of > - * the ".keep" file after being migrated to the main ODB source. > - * This ensures the lockfile can be found and removed later > - * after the ODB transaction has been committed. > - */ > - lockfile = index_pack_lockfile(base->source, child.out, NULL); > - if (lockfile) { > - ALLOC_GROW(transaction->pack_lockfiles, > - transaction->pack_lockfiles_nr + 1, > - transaction->pack_lockfiles_alloc); > - transaction->pack_lockfiles[transaction->pack_lockfiles_nr++] = > - register_tempfile(lockfile); > - free(lockfile); > - } > + ret = read_index_pack_report(repo, child.out, &pack_name, NULL); > + > close(child.out); > > status = finish_command(&child); > if (status) { > strbuf_addstr(err_msg, "index-pack abnormal exit"); > - return -1; > + goto out; > + } > + > + if (ret) { > + strbuf_addstr(err_msg, "index-pack failed to report pack name"); > + goto out; > } > > + strbuf_addf(&keep_msg, "receive-pack %"PRIuMAX" on %s", > + (uintmax_t)getpid(), hostname); > + > + if (write_pack_lockfile(transaction->quarantine, pack_name.buf, > + keep_msg.buf)) { > + strbuf_addstr(err_msg, "lockfile write failed"); > + goto out; Shouldn't we also set `ret = -1` here? > + } > + [snip]