| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2010 Juergen Wieferink |
| 4 | # |
| 5 | |
| 6 | test_description='Test repair with hidden patches |
| 7 | |
| 8 | ' |
| 9 | |
| 10 | . ./test-lib.sh |
| 11 | |
| 12 | test_expect_success \ |
| 13 | 'Initialize the StGIT repository' \ |
| 14 | 'stg init && |
| 15 | stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh && |
| 16 | stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh && |
| 17 | stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh && |
| 18 | stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh && |
| 19 | stg pop && stg hide D && |
| 20 | stg pop && |
| 21 | test "$(echo $(stg series --applied --noprefix))" = "A B" && |
| 22 | test "$(echo $(stg series --unapplied --noprefix))" = "C" && |
| 23 | test "$(echo $(stg series --hidden --noprefix))" = "D" |
| 24 | ' |
| 25 | |
| 26 | test_expect_success \ |
| 27 | 'Repair and check that nothing has changed' \ |
| 28 | 'stg repair && |
| 29 | test "$(echo $(stg series --applied --noprefix))" = "A B" && |
| 30 | test "$(echo $(stg series --unapplied --noprefix))" = "C" && |
| 31 | test "$(echo $(stg series --hidden --noprefix))" = "D" |
| 32 | ' |
| 33 | |
| 34 | test_expect_success \ |
| 35 | 'Nontrivial repair' \ |
| 36 | 'echo Z >z.txt && git add z.txt && git commit -m z && |
| 37 | stg repair && |
| 38 | test "$(echo $(stg series --applied --noprefix))" = "A B z" && |
| 39 | test "$(echo $(stg series --unapplied --noprefix))" = "C" && |
| 40 | test "$(echo $(stg series --hidden --noprefix))" = "D" |
| 41 | ' |
| 42 | |
| 43 | test_done |