Re: [PATCH v3 5/5] commit: refuse partial commits during conflict resolution
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 28, 2026, 16:18 UTC
- Message-ID
- <xmqqqzji5id2.fsf@gitster.g>
- In-Reply-To
- <050b9e8a52e531bcb17f483d0d574aaca3875adf.1787903085.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 25 quoted lines
> - if (whence != FROM_COMMIT) {
> - if (whence == FROM_MERGE)
> - die(_("cannot do a partial commit during a merge."));
> - else if (is_from_cherry_pick(whence))
> - die(_("cannot do a partial commit during a cherry-pick."));
> + switch (sequencer_ongoing_operation(the_repository, whence)) {
> + case ONGOING_NONE:
> + break;
> + case ONGOING_MERGE:
> + die(_("cannot do a partial commit during a merge."));
> + case ONGOING_CHERRY_PICK:
> + die(_("cannot do a partial commit during a cherry-pick."));
> + case ONGOING_REBASE_EMPTY:
> + /*
> + * A pick that became empty is not a conflict, and creating
> + * a new commit (partial or not) poses no problem.
> + */
> + break;
> + case ONGOING_REVERT:
> + die(_("cannot do a partial commit during a revert."));
> + case ONGOING_AM:
> + die(_("cannot do a partial commit during an am session."));
> + case ONGOING_REBASE_CONFLICT:
> + die(_("cannot do a partial commit while resolving conflicts during a rebase."));
> }Looks quite thorough. Deliberate ommission of "default:" is a plus ;-)