Disallow committing empty patches by default
[stgit.git] / t / t1304-repair-hidden.sh
blobcd910609567215c7d46655304faf9d2f746153a3
1 #!/bin/sh
2 # Copyright (c) 2010 Juergen Wieferink
4 test_description='Test repair with hidden patches'
5 . ./test-lib.sh
7 test_expect_success 'Initialize the StGit repository' '
8 stg init &&
9 stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh &&
10 stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh &&
11 stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh &&
12 stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh &&
13 stg pop && stg hide D &&
14 stg pop &&
15 test "$(echo $(stg series --applied --noprefix))" = "A B" &&
16 test "$(echo $(stg series --unapplied --noprefix))" = "C" &&
17 test "$(echo $(stg series --hidden --noprefix))" = "D"
20 test_expect_success 'Repair and check that nothing has changed' '
21 stg repair &&
22 test "$(echo $(stg series --applied --noprefix))" = "A B" &&
23 test "$(echo $(stg series --unapplied --noprefix))" = "C" &&
24 test "$(echo $(stg series --hidden --noprefix))" = "D"
27 test_expect_success 'Nontrivial repair' '
28 echo Z >z.txt && git add z.txt && git commit -m z &&
29 stg repair &&
30 test "$(echo $(stg series --applied --noprefix))" = "A B z" &&
31 test "$(echo $(stg series --unapplied --noprefix))" = "C" &&
32 test "$(echo $(stg series --hidden --noprefix))" = "D"
35 test_done