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

[PATCH] rebase--interactive: Ignore comments and blank lines in peek_next_command

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jan 11, 2010, 15:56 UTC
Message-ID
<59228d1d1e3b846b7d85f3e9752c1f0da6b1ebfc.1263224986.git.mhagger@alum.mit.edu>

Previously, blank lines and/or comments within a series of squash/fixup commands would confuse "git rebase -i" into thinking that the series was finished. It would therefore require the user to edit the commit message for the squash/fixup commits seen so far. Then, after continuing, it would ask the user to edit the commit message again.

Ignore comments and blank lines within a group of squash/fixup commands, allowing them to be processed in one go.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
This patch applies to master.  It does not conflict with either
mh/rebase-fixup or ns/rebase-auto-squash.
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index d529328..6ed57e2 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -322,7 +322,7 @@ make_squash_message () {
 }
 
 peek_next_command () {
-	sed -n "1s/ .*$//p" < "$TODO"
+	sed -n -e "/^#/d" -e "/^$/d" -e "s/ .*//p" -e "q" < "$TODO"
 }
 
 do_next () {
-- 
1.6.6.137.g5b1417
Message 1 of 1 in “rebase--interactive: Ignore comments and blank lines in peek_next_command”
  1. rebase--interactive: Ignore comments and blank lines in peek_next_commandMichael Haggerty, Jan 11, 2010

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.