Re: [PATCH] commit: refuse to amend during conflict resolution
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 26, 2026, 16:39 UTC
- Message-ID
- <xmqqqzjkj0p2.fsf@gitster.g>
- In-Reply-To
- <pull.2389.git.git.1787721681893.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> @@ -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."));
> }Let's make a mental note that the function receives these parameters:
static int parse_and_validate_options(int argc, const char *argv[], const struct option *options, const char * const usage[], const char *prefix, struct commit *current_head, struct wt_status *s)
Show 8 quoted lines
> + 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."));"the_repository" can become "s->repo". The same comment for other checks in this block.