git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 1/5] commit: clarify FROM_REBASE_PICK and is_from_rebase() names

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 1, 2026, 22:24 UTC
Message-ID
<bd361679b9144682d664e8cfcf9fc2cbd8511b4d.1788301481.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2389.v4.git.git.1788301481.gitgitgadget@gmail.com>
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)`.

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 {
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Phillip Wood
Message 34 of 43 in “commit: refuse to amend during conflict resolution”
  1. commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 26, 2026
  2. Phillip WoodAug 26, 2026
  3. Elijah NewrenAug 27, 2026
  4. Junio C HamanoAug 26, 2026
  5. Elijah NewrenAug 27, 2026
  6. Junio C HamanoAug 26, 2026
  7. Elijah NewrenAug 27, 2026
  8. 0/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  9. 1/3 commit: reword the empty-commit rebase errorsElijah Newren via GitGitGadget, Aug 27, 2026
  10. Phillip WoodAug 27, 2026
  11. Junio C HamanoAug 27, 2026
  12. Elijah NewrenAug 28, 2026
  13. Junio C HamanoAug 27, 2026
  14. Junio C HamanoAug 27, 2026
  15. Elijah NewrenAug 28, 2026
  16. 2/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  17. Phillip WoodAug 27, 2026
  18. 3/3 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  19. Phillip WoodAug 27, 2026
  20. Phillip WoodAug 27, 2026
  21. Elijah NewrenAug 27, 2026
  22. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  23. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Aug 28, 2026
  24. Junio C HamanoAug 28, 2026
  25. Elijah NewrenAug 28, 2026
  26. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Aug 28, 2026
  27. Junio C HamanoAug 28, 2026
  28. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Aug 28, 2026
  29. Junio C HamanoAug 28, 2026
  30. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  31. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  32. Junio C HamanoAug 28, 2026
  33. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  34. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Sep 1, 2026
  35. Phillip WoodSep 2, 2026
  36. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Sep 1, 2026
  37. Phillip WoodSep 2, 2026
  38. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Sep 1, 2026
  39. Phillip WoodSep 2, 2026
  40. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  41. Phillip WoodSep 2, 2026
  42. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  43. Phillip WoodSep 2, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.