2 test_description
='Test stg commit'
5 test_expect_success
'Initialize the StGit repository' '
14 test_expect_success
'Attempt to commit an empty patch' '
15 command_error stg commit p2 2>&1 | grep "Empty patch"
18 test_expect_success
'Commit middle patch' '
19 stg commit --allow-empty p2 &&
20 test "$(echo $(stg series))" = "+ p1 > p3 - p4"
23 test_expect_success
'Commit first patch' '
24 stg commit --allow-empty &&
25 test "$(echo $(stg series))" = "> p3 - p4"
28 test_expect_success
'Commit all patches' '
30 stg commit -a --allow-empty &&
31 test "$(echo $(stg series))" = ""
34 # stg commit with top != head should not succeed, since the committed
35 # patches are poptentially lost.
36 test_expect_success
'Commit when top != head (should fail)' '
38 git reset --hard HEAD^ &&
39 h=$(git rev-parse HEAD)
40 command_error stg commit --allow-empty &&
41 test "$(git rev-parse HEAD)" = "$h" &&
42 test "$(echo $(stg series))" = "> foo"