Re: [PATCH] commit: refuse to amend during conflict resolution
From: Elijah Newren <hidden>
Date: 2026-08-27 00:22:02
On Wed, Aug 26, 2026 at 6:56 AM Phillip Wood [off-list ref] wrote:
[...]
quoted
@@ -1336,6 +1337,46 @@ static int parse_and_validate_options(int argc, const char *argv[], else if (whence == FROM_REBASE_PICK) die(_("You are in the middle of a rebase -- cannot amend.")); } + if (amend && whence == FROM_COMMIT) { + char *applying, *apply_dir, *stopped_sha, *amend_marker; + int in_am, conflicted_stop; + + /* Check middle of revert */ + if (refs_ref_exists(get_main_ref_store(the_repository), + "REVERT_HEAD")) + die(_("You are in the middle of a revert -- cannot amend."));I think it would be much cleaner to move this check and sequencer related ones below into sequencer_determine_whence() so that we don't have to hard code the paths here. It might be worth checking for "am" and the "apply" based rebase in that function as well.
Moving the logic makes sense. I was a little unsure about putting it in sequencer_determine_whence() since commit has its own determine_whence() based on keeping the merge handling separate. I kind of wanted some function for ongoing_operation, so I just made a new helper, and added merge, am, and the apply-based rebase to it.
The logic looks sound to me
Thanks for taking a look!