summaryrefslogtreecommitdiff
path: root/t/lib-rebase.sh
diff options
context:
space:
mode:
authorAndrew Pimlott <andrew@pimlott.net>2013-06-27 19:26:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-27 20:52:41 (GMT)
commit22c5b136363c7aa427667876e787db832548a038 (patch)
tree9c65417aa9e672f8feb61ce00a8edbb6b7bcddc2 /t/lib-rebase.sh
parent9832cb9d4dc969fbfacfd1f8940fcbdec18bb930 (diff)
downloadgit-22c5b136363c7aa427667876e787db832548a038.zip
git-22c5b136363c7aa427667876e787db832548a038.tar.gz
git-22c5b136363c7aa427667876e787db832548a038.tar.bz2
rebase -i: handle fixup! fixup! in --autosquash
In rebase -i --autosquash, ignore all "fixup! " or "squash! " after the first. This supports the case when a git commit --fixup/--squash referred to an earlier fixup/squash instead of the original commit (whether intentionally, as when the user expressly meant to note that the commit fixes an earlier fixup; or inadvertently, as when the user meant to refer to the original commit with :/msg; or out of laziness, as when the user could remember how to refer to the fixup but not the original). In the todo list, the full commit message is preserved, in case it provides useful cues to the user. A test helper set_cat_todo_editor is introduced to check this. Helped-by: Thomas Rast <trast@inf.ethz.ch> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Andrew Pimlott <andrew@pimlott.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-rebase.sh')
-rw-r--r--t/lib-rebase.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 4b74ae4..cfd3409 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -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 () {