Thread (2 messages) flat view 2 messages, 2 authors, 2025-08-07

Re: [PATCH] rebase -i: permit 'drop' of a merge commit

From: Phillip Wood <hidden>
Date: 2025-08-07 13:39:57

Hi Johannes

On 06/08/2025 18:38, Johannes Sixt wrote:
4c063c82e9 (rebase -i: improve error message when picking merge,
2024-05-30) added advice texts for cases when a merge commit is
passed as argument of sequencer command that cannot operate with
a merge commit. However, it forgot about the 'drop' command, so
that in this case the BUG() in the default branch is reached.

Handle 'drop' like 'merge', i.e., permit it without a message.
Thanks for fixing this and also for taking the time to extend the 
regression test.

Phillip
quoted hunk ↗ jump to hunk
Signed-off-by: Johannes Sixt <redacted>
---
  sequencer.c                   | 1 +
  t/t3404-rebase-interactive.sh | 1 +
  2 files changed, 2 insertions(+)
diff --git a/sequencer.c b/sequencer.c
index aaf2e4df64..9ae40a91b2 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2720,8 +2720,9 @@ static int check_merge_commit_insn(enum todo_command command)
  	case TODO_SQUASH:
  		return error(_("cannot squash merge commit into another commit"));
  
  	case TODO_MERGE:
+	case TODO_DROP:
  		return 0;
  
  	default:
  		BUG("unexpected todo_command");
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 6bac217ed3..34d6ad0770 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -2262,8 +2262,9 @@ rebase_setup_and_clean () {
  	reword $oid
  	edit $oid
  	fixup $oid
  	squash $oid
+	drop $oid # acceptable, no advice
  	EOF
  	(
  		set_replace_editor todo &&
  		test_must_fail git rebase -i HEAD 2>actual
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help