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>err &&
16 grep "Empty patch" err
19 test_expect_success
'Commit middle patch' '
20 stg commit --allow-empty p2 &&
21 test "$(echo $(stg series))" = "+ p1 > p3 - p4"
24 test_expect_success
'Commit first patch' '
25 stg commit --allow-empty &&
26 test "$(echo $(stg series))" = "> p3 - p4"
29 test_expect_success
'Commit all patches' '
31 stg commit -a --allow-empty &&
32 test "$(echo $(stg series))" = ""
35 # stg commit with top != head should not succeed, since the committed
36 # patches are poptentially lost.
37 test_expect_success
'Commit when top != head (should fail)' '
39 git reset --hard HEAD^ &&
40 h=$(git rev-parse HEAD)
41 command_error stg commit --allow-empty &&
42 test "$(git rev-parse HEAD)" = "$h" &&
43 test "$(echo $(stg series))" = "> foo"