From fcc5ef1cc90ed49400bef51d306216f290eab9cc Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Mon, 17 Sep 2012 21:28:08 -0400 Subject: rebase -i: Refactor help messages for todo file Signed-off-by: Andrew Wong Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index a09e8423dd..4d57e50f2b 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -115,6 +115,23 @@ mark_action_done () { fi } +append_todo_help () { + cat >> "$todo" << EOF +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# +# These lines can be re-ordered; they are executed from top to bottom. +# +# If you remove a line here THAT COMMIT WILL BE LOST. +EOF +} + make_patch () { sha1_and_parents="$(git rev-list --parents -1 "$1")" case "$sha1_and_parents" in @@ -901,18 +918,10 @@ test -n "$cmd" && add_exec_commands "$todo" cat >> "$todo" << EOF # Rebase $shortrevisions onto $shortonto +EOF +append_todo_help +cat >> "$todo" << EOF # -# Commands: -# p, pick = use commit -# r, reword = use commit, but edit the commit message -# e, edit = use commit, but stop for amending -# s, squash = use commit, but meld into previous commit -# f, fixup = like "squash", but discard this commit's log message -# x, exec = run command (the rest of the line) using shell -# -# These lines can be re-ordered; they are executed from top to bottom. -# -# If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # EOF -- cgit v1.2.3 From eb9a7cb4bdbd4ea9c7e7ef2ca8de5b2753e3584c Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Mon, 17 Sep 2012 21:28:09 -0400 Subject: rebase -i: Teach "--edit-todo" action 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 Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 4d57e50f2b..2b8f2a9f42 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -792,6 +792,23 @@ skip) do_rest ;; +edit-todo) + sed -e '/^#/d' < "$todo" > "$todo".new + mv -f "$todo".new "$todo" + append_todo_help + cat >> "$todo" << EOF +# +# You are editing the todo file of an ongoing interactive rebase. +# To continue rebase after editing, run: +# git rebase --continue +# +EOF + + git_sequence_editor "$todo" || + die "Could not execute editor" + + exit + ;; esac git var GIT_COMMITTER_IDENT >/dev/null || -- cgit v1.2.3 From 9c8e1011b9f6979777946ff87aae7b5846ed20a7 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 19 Sep 2012 08:43:54 +0200 Subject: rebase -i: suggest using --edit-todo to fix an unknown instruction We have now an explicit UI to edit the todo sheet and need not disclose the name of the file. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 2b8f2a9f42..4b2ef11e59 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -575,11 +575,12 @@ do_next () { ;; *) warn "Unknown command: $command $sha1 $rest" + fixtodo="Please fix this using 'git rebase --edit-todo'." if git rev-parse --verify -q "$sha1" >/dev/null then - die_with_patch $sha1 "Please fix this in the file $todo." + die_with_patch $sha1 "$fixtodo" else - die "Please fix this in the file $todo." + die "$fixtodo" fi ;; esac -- cgit v1.2.3