rebase -i: handle fixup! fixup! in --autosquash
[gitweb.git] / t / lib-rebase.sh
index 4b74ae460b8943c176b6563d374e1663f89a1d7b..cfd340943b55dde44208e24bf94a1b46416b2445 100644 (file)
@@ -66,6 +66,20 @@ EOF
        chmod a+x fake-editor.sh
 }
 
+# After set_cat_todo_editor, rebase -i will write the todo list (ignoring
+# blank lines and comments) to stdout, and exit failure (so you should run
+# it with test_must_fail).  This can be used to verify the expected user
+# experience, for todo list changes that do not affect the outcome of
+# rebase; or as an extra check in addition to checking the outcome.
+
+set_cat_todo_editor () {
+       write_script fake-editor.sh <<-\EOF
+       grep "^[^#]" "$1"
+       exit 1
+       EOF
+       test_set_editor "$(pwd)/fake-editor.sh"
+}
+
 # checks that the revisions in "$2" represent a linear range with the
 # subjects in "$1"
 test_linear_range () {