Re: [PATCH v3 1/3] replay: allow callers to control what happens with empty commits
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 12, 2026, 04:51 UTC
- Message-ID
- <xmqq7bp9p6wz.fsf@gitster.g>
- In-Reply-To
- <20260427-b4-pks-history-fixup-v3-1-cb908f06264b@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 13 quoted lines
> + /* Handle commits that become empty */
> if (oideq(&replayed_base_tree->object.oid, &result->tree->object.oid) &&
> - !oideq(&pickme_tree->object.oid, &base_tree->object.oid))
> - return replayed_base;
> + !oideq(&pickme_tree->object.oid, &base_tree->object.oid)) {
> + switch (empty) {
> + case REPLAY_EMPTY_COMMIT_DROP:
> + return replayed_base;
> + case REPLAY_EMPTY_COMMIT_KEEP:
> + break;
> + case REPLAY_EMPTY_COMMIT_ABORT:
> + result->clean = error(_("commit %s became empty after replay"),
> + oid_to_hex(&pickme->object.oid));OK. merge-ort.h clearly explains what negative values in .clean member means, so this is a good way to signal a failure up the call chain.
> + return NULL; > + } > + }