Re: [PATCH 2/3] rebase -i: Teach "--edit-todo" action

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/3] rebase -i: Teach "--edit-todo" action

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:46

Andrew Wong [off-list ref] writes:
quoted hunk
This allows users to edit the todo file while they're stopped in the
middle of an interactive rebase. When this action is executed, all
comments from the original todo file are stripped, and new help messages
are appended to the end.

Signed-off-by: Andrew Wong <redacted>
---
 Documentation/git-rebase.txt |  5 ++++-
 git-rebase--interactive.sh   | 16 ++++++++++++++++
 git-rebase.sh                | 14 ++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index fd535b0..da067ec 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 	[<upstream>] [<branch>]
 'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
 	--root [<branch>]
-'git rebase' --continue | --skip | --abort
+'git rebase' --continue | --skip | --abort | --edit-todo
 
 DESCRIPTION
 -----------
@@ -245,6 +245,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.
 --skip::
 	Restart the rebasing process by skipping the current patch.
 
+--edit-todo::
+	Edit the todo list during an interactive rebase.
+
 -m::
 --merge::
 	Use merging strategies to rebase.  When the recursive (default) merge
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4d57e50..ca55fac 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -792,6 +792,22 @@ skip)
 
 	do_rest
 	;;
+edit-todo)
+	sed -i '/^#/d' "$todo"
+	append_todo_help
I do not think the "sed -i" in-place edit is portable.  AFAIK, it is
not even in POSIX.1

In any case, what information are you discarding and then replacing
with the standard boilerplate?
quoted hunk
diff --git a/git-rebase.sh b/git-rebase.sh
index 15da926..e660203 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -38,6 +38,7 @@ C=!                passed to 'git apply'
 continue!          continue
 abort!             abort and check out the original branch
 skip!              skip current patch and continue
+edit-todo!         edit the todo list during an interactive rebase
 "
 . git-sh-setup
 . git-sh-i18n
@@ -194,6 +195,10 @@ do
 		test $total_argc -eq 2 || usage
 		action=${1##--}
 		;;
+	--edit-todo)
+		test $total_argc -eq 2 || usage
+		action=${1##--}
+		;;
 	--onto)
 		test 2 -le "$#" || usage
 		onto="$2"
@@ -306,6 +311,12 @@ then
 	fi
 fi
 
+if test "$action" = "edit-todo" &&
+	test "$type" != "interactive"
I do not see a need to split this short expression into two lines.

Re: [PATCH 2/3] rebase -i: Teach "--edit-todo" action

From: Andrew Wong <hidden>
Date: 2016-06-15 22:54:46

On 09/16/12 02:54, Junio C Hamano wrote:
In any case, what information are you discarding and then replacing
with the standard boilerplate?
It's to strip out the comment that says:

    # However, if you remove everything, the rebase will be aborted.

As there's no way reliable way to know where that line is and remove it,
the only way I can think of is to remove all the comments, and append
the help messages again.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help