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 1/5] commit: clarify FROM_REBASE_PICK and is_from_rebase() names
Date: Wed, 2 Sep 2026 16:39:09 +0100	[thread overview]
Message-ID: <1c3f07e0-63c0-483d-8e46-e4edbdd6991a@gmail.com> (raw)
In-Reply-To: <bd361679b9144682d664e8cfcf9fc2cbd8511b4d.1788301481.git.gitgitgadget@gmail.com>

Hi Elijah

On 01/09/2026 23:24, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
> 
> Commit 430b75f7209c (commit: give correct advice for empty commit during
> a rebase, 2019-12-06) introduced a FROM_REBASE_PICK enum value and an
> is_from_rebase() function.  Those names failed to convey that they were
> specifically about hitting a commit that becomes empty when rebasing.
> Clarify their names now.
> 
> While at it, change `whence == FROM_REBASE_NOW_EMPTY` to use
> `is_from_rebase_now_empty(whence)`.

This looks good, the new names are much clearer

Thanks

Phillip

> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>   builtin/commit.c | 14 +++++++-------
>   sequencer.c      |  2 +-
>   wt-status.h      |  6 +++---
>   3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 28f6174503..17cc27e53e 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -520,7 +520,7 @@ 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(whence))
> +		else if (is_from_rebase_now_empty(whence))
>   			die(_("cannot do a partial commit during a rebase."));
>   	}
>   
> @@ -893,7 +893,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>   	 */
>   	else if (whence == FROM_MERGE)
>   		hook_arg1 = "merge";
> -	else if (is_from_cherry_pick(whence) || whence == FROM_REBASE_PICK) {
> +	else if (is_from_cherry_pick(whence) || is_from_rebase_now_empty(whence)) {
>   		hook_arg1 = "commit";
>   		hook_arg2 = "CHERRY_PICK_HEAD";
>   	}
> @@ -1086,7 +1086,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>   		if (amend)
>   			fputs(_(empty_amend_advice), stderr);
>   		else if (is_from_cherry_pick(whence) ||
> -			 whence == FROM_REBASE_PICK) {
> +			 is_from_rebase_now_empty(whence)) {
>   			fputs(_(empty_cherry_pick_advice), stderr);
>   			if (whence == FROM_CHERRY_PICK_SINGLE)
>   				fputs(_(empty_cherry_pick_advice_single), stderr);
> @@ -1333,7 +1333,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
>   			die(_("You are in the middle of a merge -- cannot amend."));
>   		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)
> +		else if (is_from_rebase_now_empty(whence))
>   			die(_("You are in the middle of a rebase -- cannot amend."));
>   	}
>   	if (fixup_message && squash_message)
> @@ -1353,7 +1353,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
>   	if (amend && !use_message && !fixup_message)
>   		use_message = "HEAD";
>   	if (!use_message && !is_from_cherry_pick(whence) &&
> -	    !is_from_rebase(whence) && renew_authorship)
> +	    !is_from_rebase_now_empty(whence) && renew_authorship)
>   		die(_("--reset-author can be used only with -C, -c or --amend."));
>   	if (use_message) {
>   		use_message_buffer = read_commit_message(use_message);
> @@ -1362,7 +1362,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
>   			author_message_buffer = use_message_buffer;
>   		}
>   	}
> -	if ((is_from_cherry_pick(whence) || whence == FROM_REBASE_PICK) &&
> +	if ((is_from_cherry_pick(whence) || is_from_rebase_now_empty(whence)) &&
>   	    !renew_authorship) {
>   		author_message = "CHERRY_PICK_HEAD";
>   		author_message_buffer = read_commit_message(author_message);
> @@ -1887,7 +1887,7 @@ int cmd_commit(int argc,
>   		if (!reflog_msg)
>   			reflog_msg = is_from_cherry_pick(whence)
>   					? "commit (cherry-pick)"
> -					: is_from_rebase(whence)
> +					: is_from_rebase_now_empty(whence)
>   					? "commit (rebase)"
>   					: "commit";
>   		commit_list_insert(current_head, &parents);
> diff --git a/sequencer.c b/sequencer.c
> index 65afd100d9..d336c309ca 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -6956,7 +6956,7 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
>   		    !repo_get_oid(r, "REBASE_HEAD", &rebase_head) &&
>   		    !repo_get_oid(r, "CHERRY_PICK_HEAD", &cherry_pick_head) &&
>   		    oideq(&rebase_head, &cherry_pick_head))
> -			*whence = FROM_REBASE_PICK;
> +			*whence = FROM_REBASE_NOW_EMPTY;
>   		else
>   			*whence = FROM_CHERRY_PICK_SINGLE;
>   
> diff --git a/wt-status.h b/wt-status.h
> index e9fe32e98c..2143f50b49 100644
> --- a/wt-status.h
> +++ b/wt-status.h
> @@ -41,7 +41,7 @@ enum commit_whence {
>   	FROM_MERGE,      /* commit came from merge */
>   	FROM_CHERRY_PICK_SINGLE, /* commit came from cherry-pick */
>   	FROM_CHERRY_PICK_MULTI, /* commit came from a sequence of cherry-picks */
> -	FROM_REBASE_PICK /* commit came from a pick/reword/edit */
> +	FROM_REBASE_NOW_EMPTY /* rebase applied a pick that became empty */
>   };
>   
>   static inline int is_from_cherry_pick(enum commit_whence whence)
> @@ -50,9 +50,9 @@ static inline int is_from_cherry_pick(enum commit_whence whence)
>   		whence == FROM_CHERRY_PICK_MULTI;
>   }
>   
> -static inline int is_from_rebase(enum commit_whence whence)
> +static inline int is_from_rebase_now_empty(enum commit_whence whence)
>   {
> -	return whence == FROM_REBASE_PICK;
> +	return whence == FROM_REBASE_NOW_EMPTY;
>   }
>   
>   struct wt_status_change_data {


  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 [this message]
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
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=1c3f07e0-63c0-483d-8e46-e4edbdd6991a@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