3 test_description
='Simple test cases for "stg undo"'
7 # Ignore our own output files.
8 cat > .git
/info
/exclude
<<EOF
13 test_expect_success
'Initialize StGit stack with three patches' '
19 git commit -a -m p1 &&
21 git commit -a -m p2 &&
23 git commit -a -m p3 &&
25 test "$(stg id)" = "$(stg id $(stg top))"
28 cat > expected.txt
<<EOF
31 test_expect_success
'Pop middle patch, creating a conflict' '
32 conflict stg pop p2 &&
33 stg status a > actual.txt &&
34 test_cmp expected.txt actual.txt &&
35 test "$(echo $(stg series))" = "+ p1 > p3 - p2" &&
36 test "$(stg id)" = "$(stg id $(stg top))"
39 test_expect_success
'Try to undo without --hard' '
40 command_error stg undo &&
41 stg status a > actual.txt &&
42 test_cmp expected.txt actual.txt &&
43 test "$(echo $(stg series))" = "+ p1 > p3 - p2" &&
44 test "$(stg id)" = "$(stg id $(stg top))"
47 cat > expected.txt
<<EOF
49 test_expect_success
'Try to undo with --hard' '
51 stg status a > actual.txt &&
52 test_cmp expected.txt actual.txt &&
53 test "$(echo $(stg series))" = "+ p1 + p2 > p3" &&
54 test "$(stg id)" = "$(stg id $(stg top))"