lib-rebase: Allow comments and blank lines to be added to the rebase script
(For testing "rebase -i"): Support new action types in $FAKE_LINES to allow comments and blank lines to be added to the "rebase -i" command list. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Jan 12, 2010 at 16:38 UTC
05c95dbe44b42f9c3f7efe6793d311a26e1b8181
1 file changed
+16
-5
t/lib-rebase.sh
+16
-5
@@ -5,13 +5,20 @@
5
# - override the commit message with $FAKE_COMMIT_MESSAGE,
6
# - amend the commit message with $FAKE_COMMIT_AMEND
7
# - check that non-commit messages have a certain line count with $EXPECT_COUNT
8
-# - rewrite a rebase -i script with $FAKE_LINES in the form
8
+# - rewrite a rebase -i script as directed by $FAKE_LINES.
9
+# $FAKE_LINES consists of a sequence of words separated by spaces.
10
+# The following word combinations are possible:
11
#
10
-# "[<lineno1>] [<lineno2>]..."
12
+# "<lineno>" -- add a "pick" line with the SHA1 taken from the
13
+# specified line.
14
#
12
-# If a line number is prefixed with "squash", "fixup", "edit", or
13
-# "reword", the respective line's command will be replaced with the
14
-# specified one.
15
+# "<cmd> <lineno>" -- add a line with the specified command
16
+# ("squash", "fixup", "edit", or "reword") and the SHA1 taken
17
+# from the specified line.
18
+#
19
+# "#" -- Add a comment line.
20
+#
21
+# ">" -- Add a blank line.
22
23
set_fake_editor () {
24
echo "#!$SHELL_PATH" >fake-editor.sh
@@ -36,6 +43,10 @@ for line in $FAKE_LINES; do
43
case $line in
44
squash|fixup|edit|reword)
45
action="$line";;
46
+ "#")
47
+ echo '# comment' >> "$1";;
48
+ ">")
49
+ echo >> "$1";;
50
*)
51
sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
52
action=pick;;