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

Re: [BUG] git-rebase fails when a commit message contains a diff

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 9, 2007, 02:18 UTC
Message-ID
<7v640cxitc.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vhcjwxk1s.fsf@gitster.siamese.dyndns.org>

I wonder if this is a sensible thing to do, regardless of the issue of commit log message that contains anything.

The patch replaces git-rebase with git-rebase--interactive. The only difference from the existing "git-rebase -i" is if the command is called without "-i" the initial "here is the to-do list. please rearrange the lines, modify 'pick' to 'edit' or whatever as appropriate" step is done without letting the user edit the list.

---
 Makefile                                    |    2 +-
 git-rebase--interactive.sh => git-rebase.sh |   14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 0d5590f..f0e5e38 100644
--- a/Makefile
+++ b/Makefile
@@ -214,7 +214,7 @@ SCRIPT_SH = \
 	git-clean.sh git-clone.sh git-commit.sh \
 	git-ls-remote.sh \
 	git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
-	git-pull.sh git-rebase.sh git-rebase--interactive.sh \
+	git-pull.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh \
 	git-sh-setup.sh \
 	git-am.sh \
diff --git a/git-rebase--interactive.sh b/git-rebase.sh
similarity index 98%
rename from git-rebase--interactive.sh
rename to git-rebase.sh
index 76dc679..1dd6f6d 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase.sh
@@ -11,7 +11,7 @@
 # http://article.gmane.org/gmane.comp.version-control.git/22407
 
 USAGE='(--continue | --abort | --skip | [--preserve-merges] [--verbose]
-	[--onto <branch>] <upstream> [<branch>])'
+	[--interactive] [--onto <branch>] <upstream> [<branch>])'
 
 . git-sh-setup
 require_work_tree
@@ -25,6 +25,7 @@ REWRITTEN="$DOTEST"/rewritten
 PRESERVE_MERGES=
 STRATEGY=
 VERBOSE=
+INTERACTIVE=
 test -d "$REWRITTEN" && PRESERVE_MERGES=t
 test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
 test -f "$DOTEST"/verbose && VERBOSE=t
@@ -346,6 +347,9 @@ do_rest () {
 while test $# != 0
 do
 	case "$1" in
+	--interactive|-i)
+		INTERACTIVE=t
+		;;
 	--continue)
 		comment_for_reflog continue
 
@@ -504,9 +508,11 @@ EOF
 			die_abort "Nothing to do"
 
 		cp "$TODO" "$TODO".backup
-		git_editor "$TODO" ||
-			die "Could not execute editor"
-
+		case "$INTERACTIVE" in
+		t)
+			git_editor "$TODO" || die "Could not execute editor"
+			;;
+		esac
 		has_action "$TODO" ||
 			die_abort "Nothing to do"
 
Previous: Junio C HamanoNext: Johannes Schindelin
Message 4 of 17 in “[BUG] git-rebase fails when a commit message contains a diff”
  1. Jonas FonsecaNov 9, 2007
  2. Junio C HamanoNov 9, 2007
  3. Junio C HamanoNov 9, 2007
  4. Junio C HamanoNov 9, 2007
  5. Johannes SchindelinNov 9, 2007
  6. Junio C HamanoNov 9, 2007
  7. Johannes SchindelinNov 9, 2007
  8. Björn SteinbrinkNov 11, 2007
  9. Benoit SigoureNov 9, 2007
  10. Johannes SixtNov 9, 2007
  11. Ralf WildenhuesNov 9, 2007
  12. Benoit SigoureNov 9, 2007
  13. Johannes SchindelinNov 9, 2007
  14. Andreas EricssonNov 9, 2007
  15. Steffen ProhaskaNov 9, 2007
  16. Johannes SchindelinNov 9, 2007
  17. Steffen ProhaskaNov 9, 2007

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.