From: Junio C Hamano Date: Tue, 12 May 2026 04:51:08 GMT Subject: Re: [PATCH v3 1/3] replay: allow callers to control what happens with empty commits Message-ID: In-Reply-To: <20260427-b4-pks-history-fixup-v3-1-cb908f06264b@pks.im> Patrick Steinhardt writes: > + /* 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; > + } > + }