gitignore: Add ChangeLog to .gitignore
[stgit.git] / t / t1303-commit.sh
blob2d8507806a8f753e89d04fadae725a0059d3637b
1 #!/bin/sh
2 test_description='Test stg commit'
3 . ./test-lib.sh
5 test_expect_success 'Initialize the StGIT repository' '
6 stg init
9 test_expect_success 'Commit middle patch' '
10 stg new -m p1 &&
11 stg new -m p2 &&
12 stg new -m p3 &&
13 stg new -m p4 &&
14 stg pop &&
15 stg commit p2 &&
16 test "$(echo $(stg series))" = "+ p1 > p3 - p4"
19 test_expect_success 'Commit first patch' '
20 stg commit &&
21 test "$(echo $(stg series))" = "> p3 - p4"
24 test_expect_success 'Commit all patches' '
25 stg push &&
26 stg commit -a &&
27 test "$(echo $(stg series))" = ""
30 # stg commit with top != head should not succeed, since the committed
31 # patches are poptentially lost.
32 test_expect_success 'Commit when top != head (should fail)' '
33 stg new -m foo &&
34 git reset --hard HEAD^ &&
35 h=$(git rev-parse HEAD)
36 command_error stg commit &&
37 test $(git rev-parse HEAD) = $h &&
38 test "$(echo $(stg series))" = "> foo"
41 test_done