From: Junio C Hamano <gitster@pobox.com>
To: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>,
Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2 1/3] commit: reword the empty-commit rebase errors
Date: Thu, 27 Aug 2026 09:35:42 -0700 [thread overview]
Message-ID: <xmqq5x0vbjxd.fsf@gitster.g> (raw)
In-Reply-To: <65c48ed3cb638cf0be18a3aa6d86d4c4f2cf01a2.1787792534.git.gitgitgadget@gmail.com> (Elijah Newren via GitGitGadget's message of "Thu, 27 Aug 2026 01:02:12 +0000")
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Elijah Newren <newren@gmail.com>
>
> When a rebase applies a commit that becomes empty, it stops and asks the
> user to decide whether to keep it or drop it. HEAD still points at the
> previously-applied commit at that point, so either amending or creating
> a partial commit is refused, with one of the following messages:
>
> You are in the middle of a rebase -- cannot amend.
> cannot do a partial commit during a rebase.
>
> Neither message hints that the real problem is a commit that became
> empty, and "during a rebase" is overly broad besides -- amending and
> partial commits are fine at an `edit` or `break` stop. Reword both to
> describe the actual situation.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> builtin/commit.c | 4 ++--
> t/t3404-rebase-interactive.sh | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 28f6174503..0d908d72bb 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -521,7 +521,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
> else if (is_from_cherry_pick(whence))
> die(_("cannot do a partial commit during a cherry-pick."));
> else if (is_from_rebase(whence))
> - die(_("cannot do a partial commit during a rebase."));
> + die(_("cannot do a partial commit while resolving a commit that became empty."));
That is a mouthful. It also is awkward to say "while resolving a commit".
More importantly, I am not sure if whence == FROM_REBASE_PICK at
this point in the code flow is a sufficient sign to tell that we
were not just in the middle of a rebase, not just a rebase stopped
with _some_ conflict, but the way the rebase stopped was because a
step in rebase resulted in a commit that is no-op relative to the
previous commit. What makes us certain that the rebase-pick is
empty?
> @@ -1334,7 +1334,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
> else if (is_from_cherry_pick(whence))
> die(_("You are in the middle of a cherry-pick -- cannot amend."));
> else if (whence == FROM_REBASE_PICK)
> - die(_("You are in the middle of a rebase -- cannot amend."));
> + die(_("You are resolving a commit that became empty -- cannot amend."));
> }
Again "resolving a commit" sounds a bit awkward. What makes us
certain that we aren't seeing an ordinary conflicted "pick" step but
the one that has become empty? If "rebase -i" stopped for conflict
while applying one step, you edited away conflicts in the working
tree files, and instead of saying "rebase --continue" tried to run
"commit --amend" by mistake, we do want to stop, but wouldn't it
surprise us if the message to stop us said something about "became
empty"?
next prev parent reply other threads:[~2026-08-27 16:35 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 5:21 [PATCH] commit: refuse to amend during conflict resolution Elijah Newren via GitGitGadget
2026-08-26 13:56 ` Phillip Wood
2026-08-27 0:21 ` Elijah Newren
2026-08-26 16:22 ` Junio C Hamano
2026-08-27 0:23 ` Elijah Newren
2026-08-26 16:39 ` Junio C Hamano
2026-08-27 0:24 ` Elijah Newren
2026-08-27 1:02 ` [PATCH v2 0/3] " Elijah Newren via GitGitGadget
2026-08-27 1:02 ` [PATCH v2 1/3] commit: reword the empty-commit rebase errors Elijah Newren via GitGitGadget
2026-08-27 15:19 ` Phillip Wood
2026-08-27 16:54 ` Junio C Hamano
2026-08-28 7:38 ` Elijah Newren
2026-08-27 16:35 ` Junio C Hamano [this message]
2026-08-27 16:52 ` Junio C Hamano
2026-08-28 7:38 ` Elijah Newren
2026-08-27 1:02 ` [PATCH v2 2/3] commit: refuse to amend during conflict resolution Elijah Newren via GitGitGadget
2026-08-27 15:19 ` Phillip Wood
2026-08-27 1:02 ` [PATCH v2 3/3] commit: refuse partial commits " Elijah Newren via GitGitGadget
2026-08-27 15:19 ` Phillip Wood
2026-08-27 15:19 ` [PATCH v2 0/3] commit: refuse to amend " Phillip Wood
2026-08-27 16:28 ` Elijah Newren
2026-08-28 7:44 ` [PATCH v3 0/5] " Elijah Newren via GitGitGadget
2026-08-28 7:44 ` [PATCH v3 1/5] commit: clarify FROM_REBASE_PICK and is_from_rebase() names Elijah Newren via GitGitGadget
2026-08-28 15:41 ` Junio C Hamano
2026-08-28 17:27 ` Elijah Newren
2026-08-28 7:44 ` [PATCH v3 2/5] commit: allow a partial commit when a rebase pick becomes empty Elijah Newren via GitGitGadget
2026-08-28 15:46 ` Junio C Hamano
2026-08-28 7:44 ` [PATCH v3 3/5] commit: reword the empty-commit rebase amend error Elijah Newren via GitGitGadget
2026-08-28 15:49 ` Junio C Hamano
2026-08-28 7:44 ` [PATCH v3 4/5] commit: refuse to amend during conflict resolution Elijah Newren via GitGitGadget
2026-08-28 7:44 ` [PATCH v3 5/5] commit: refuse partial commits " Elijah Newren via GitGitGadget
2026-08-28 16:18 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5x0vbjxd.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.