| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Run "stg clean"' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'Initialize StGit stack' ' |
| 8 | stg init && |
| 9 | stg new e0 -m e0 && |
| 10 | stg new p0 -m p0 && |
| 11 | echo foo > foo.txt && |
| 12 | git add foo.txt && |
| 13 | stg refresh && |
| 14 | stg new e1 -m e1 && |
| 15 | stg new e2 -m e2 && |
| 16 | stg pop |
| 17 | ' |
| 18 | |
| 19 | test_expect_success 'Clean empty patches' ' |
| 20 | [ "$(echo $(stg applied))" = "e0 p0 e1" ] && |
| 21 | [ "$(echo $(stg unapplied))" = "e2" ] && |
| 22 | stg clean && |
| 23 | [ "$(echo $(stg applied))" = "p0" ] && |
| 24 | [ "$(echo $(stg unapplied))" = "" ] |
| 25 | ' |
| 26 | |
| 27 | test_done |