| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Run "stg coalesce"' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'Initialize StGit stack' ' |
| 8 | stg init && |
| 9 | for i in 0 1 2 3; do |
| 10 | stg new p$i -m "foo $i" && |
| 11 | echo "foo $i" >> foo.txt && |
| 12 | git add foo.txt && |
| 13 | stg refresh |
| 14 | done |
| 15 | ' |
| 16 | |
| 17 | test_expect_success 'Coalesce some patches' ' |
| 18 | [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] && |
| 19 | [ "$(echo $(stg unapplied))" = "" ] && |
| 20 | stg coalesce --name=q0 --message="wee woo" p1 p2 && |
| 21 | [ "$(echo $(stg applied))" = "p0 q0 p3" ] && |
| 22 | [ "$(echo $(stg unapplied))" = "" ] |
| 23 | ' |
| 24 | |
| 25 | test_expect_success 'Coalesce at stack top' ' |
| 26 | stg coalesce --name=q1 --message="wee woo wham" q0 p3 && |
| 27 | [ "$(echo $(stg applied))" = "p0 q1" ] && |
| 28 | [ "$(echo $(stg unapplied))" = "" ] |
| 29 | ' |
| 30 | |
| 31 | test_done |