We're half-way there with the separate indexes
[stgit] / t / t2600-coalesce.sh
index f13a309..9a043fd 100755 (executable)
@@ -15,17 +15,30 @@ test_expect_success 'Initialize StGit stack' '
 '
 
 test_expect_success 'Coalesce some patches' '
-    [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
-    [ "$(echo $(stg unapplied))" = "" ] &&
+    [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
     stg coalesce --name=q0 --message="wee woo" p1 p2 &&
-    [ "$(echo $(stg applied))" = "p0 q0 p3" ] &&
-    [ "$(echo $(stg unapplied))" = "" ]
+    [ "$(echo $(stg series --applied --noprefix))" = "p0 q0 p3" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
 '
 
 test_expect_success 'Coalesce at stack top' '
     stg coalesce --name=q1 --message="wee woo wham" q0 p3 &&
-    [ "$(echo $(stg applied))" = "p0 q1" ] &&
-    [ "$(echo $(stg unapplied))" = "" ]
+    [ "$(echo $(stg series --applied --noprefix))" = "p0 q1" ] &&
+    [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
+'
+
+cat > editor <<EOF
+#!/bin/sh
+echo "Editor was invoked" | tee editor-invoked
+EOF
+chmod a+x editor
+test_expect_success 'Coalesce with top != head' '
+    echo blahonga >> foo.txt &&
+    git commit -a -m "a new commit" &&
+    EDITOR=./editor command_error stg coalesce --name=r0 p0 q1 &&
+    test "$(echo $(stg series))" = "+ p0 > q1" &&
+    test ! -e editor-invoked
 '
 
 test_done