rebase -i: Refactor help messages for todo file

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Andrew Wong committed Sep 17, 2012 at 21:28 UTC fcc5ef1cc90ed49400bef51d306216f290eab9cc
1 file changed +20 -11
git-rebase--interactive.sh
+20 -11
@@ -115,6 +115,23 @@ mark_action_done () {
115 fi
116 }
117
118 +append_todo_help () {
119 + cat >> "$todo" << EOF
120 +#
121 +# Commands:
122 +# p, pick = use commit
123 +# r, reword = use commit, but edit the commit message
124 +# e, edit = use commit, but stop for amending
125 +# s, squash = use commit, but meld into previous commit
126 +# f, fixup = like "squash", but discard this commit's log message
127 +# x, exec = run command (the rest of the line) using shell
128 +#
129 +# These lines can be re-ordered; they are executed from top to bottom.
130 +#
131 +# If you remove a line here THAT COMMIT WILL BE LOST.
132 +EOF
133 +}
134 +
135 make_patch () {
136 sha1_and_parents="$(git rev-list --parents -1 "$1")"
137 case "$sha1_and_parents" in
@@ -901,18 +918,10 @@ test -n "$cmd" && add_exec_commands "$todo"
918 cat >> "$todo" << EOF
919
920 # Rebase $shortrevisions onto $shortonto
921 +EOF
922 +append_todo_help
923 +cat >> "$todo" << EOF
924 #
905 -# Commands:
906 -# p, pick = use commit
907 -# r, reword = use commit, but edit the commit message
908 -# e, edit = use commit, but stop for amending
909 -# s, squash = use commit, but meld into previous commit
910 -# f, fixup = like "squash", but discard this commit's log message
911 -# x, exec = run command (the rest of the line) using shell
912 -#
913 -# These lines can be re-ordered; they are executed from top to bottom.
914 -#
915 -# If you remove a line here THAT COMMIT WILL BE LOST.
925 # However, if you remove everything, the rebase will be aborted.
926 #
927 EOF