Git development
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v4 2/5] commit: allow a partial commit when a rebase pick becomes empty
Date: Wed, 2 Sep 2026 16:39:15 +0100	[thread overview]
Message-ID: <9950415d-ca3b-453b-9b0f-28c09a3d7f23@gmail.com> (raw)
In-Reply-To: <a0b9900437e7c2833960e5046b5acb6703f014b9.1788301481.git.gitgitgadget@gmail.com>

Hi Elijah

On 01/09/2026 23:24, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
> 
> For years, we disallowed partial commits during merges or cherry-picks.
> In commit 430b75f7209c (commit: give correct advice for empty commit
> during a rebase, 2019-12-06) it was noted that the "cannot do a partial
> commit during a cherry-pick" message was also printed when rebasing a
> commit that became empty, and rather than drop the check in that case,
> that commit opted to make the message print the actual operation that
> was in progress.
> 
> Since a commit that has become empty comes without conflicts, a new
> partial commit poses no problems; remove the error in that case.

I'm not quite sure what I think about this. When we stop for a commit 
that becomes empty, we write CHERRY_PICK_HEAD and .git/MERGE_MSG so the 
user can preserve the commit by running "git commit --allow-empty". That 
makes me think we should complain about a partial commit. It also seems 
inconsistent with "git cherry-pick" where we still disallow a partial 
commit when we stop for a commit that becomes empty.

On the other hand, if the user has asked to edit the commit then 
allowing a partial commit would probably make sense as we know they 
wanted to modify it in some way. As I can't make up my mind I think its 
fair to say I don't have a strong opinion either way.

Thanks

Phillip

> 
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>   builtin/commit.c              | 2 --
>   t/t3404-rebase-interactive.sh | 5 ++---
>   2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 17cc27e53e..01b79185e7 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -520,8 +520,6 @@ static const char *prepare_index(const char **argv, const char *prefix,
>   			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."));
> -		else if (is_from_rebase_now_empty(whence))
> -			die(_("cannot do a partial commit during a rebase."));
>   	}
>   
>   	if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index ff11abb2f2..3588e16543 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1858,7 +1858,7 @@ test_expect_success 'post-commit hook is called' '
>   	test_cmp expect actual
>   '
>   
> -test_expect_success 'correct error message for partial commit after empty pick' '
> +test_expect_success 'partial commit is allowed when a rebase pick becomes empty' '
>   	test_when_finished "git rebase --abort" &&
>   	(
>   		set_fake_editor &&
> @@ -1867,8 +1867,7 @@ test_expect_success 'correct error message for partial commit after empty pick'
>   		test_must_fail git rebase -i A D
>   	) &&
>   	echo x >file1 &&
> -	test_must_fail git commit file1 2>err &&
> -	test_grep "cannot do a partial commit during a rebase." err
> +	git commit file1
>   '
>   
>   test_expect_success 'correct error message for commit --amend after empty pick' '


  reply	other threads:[~2026-09-02 15:39 UTC|newest]

Thread overview: 43+ 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
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
2026-09-01 22:24 ` [PATCH v4 0/5] commit: refuse to amend " Elijah Newren via GitGitGadget
2026-09-01 22:24   ` [PATCH v4 1/5] commit: clarify FROM_REBASE_PICK and is_from_rebase() names Elijah Newren via GitGitGadget
2026-09-02 15:39     ` Phillip Wood
2026-09-01 22:24   ` [PATCH v4 2/5] commit: allow a partial commit when a rebase pick becomes empty Elijah Newren via GitGitGadget
2026-09-02 15:39     ` Phillip Wood [this message]
2026-09-01 22:24   ` [PATCH v4 3/5] commit: reword the empty-commit rebase amend error Elijah Newren via GitGitGadget
2026-09-02 15:39     ` Phillip Wood
2026-09-01 22:24   ` [PATCH v4 4/5] commit: refuse to amend during conflict resolution Elijah Newren via GitGitGadget
2026-09-02 15:39     ` Phillip Wood
2026-09-01 22:24   ` [PATCH v4 5/5] commit: refuse partial commits " Elijah Newren via GitGitGadget
2026-09-02 15:41   ` [PATCH v4 0/5] commit: refuse to amend " Phillip Wood

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=9950415d-ca3b-453b-9b0f-28c09a3d7f23@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox