3 test_description='Run "stg coalesce"'
7 test_expect_success 'Initialize StGit stack' '
10 stg new p$i -m "foo $i" &&
11 echo "foo $i" >> foo.txt &&
17 test_expect_success 'Coalesce some patches' '
18 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
19 [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
20 stg coalesce --name=q0 --message="wee woo" p1 p2 &&
21 [ "$(echo $(stg series --applied --noprefix))" = "p0 q0 p3" ] &&
22 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
25 test_expect_success 'Coalesce at stack top' '
26 stg coalesce --name=q1 --message="wee woo wham" q0 p3 &&
27 [ "$(echo $(stg series --applied --noprefix))" = "p0 q1" ] &&
28 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
33 echo "Editor was invoked" | tee editor-invoked
36 test_expect_success 'Coalesce with top != head' '
37 echo blahonga >> foo.txt &&
38 git commit -a -m "a new commit" &&
39 EDITOR=./editor command_error stg coalesce --name=r0 p0 q1 &&
40 test "$(echo $(stg series))" = "+ p0 > q1" &&
41 test ! -e editor-invoked