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 &&
27 cat > expected.txt <<EOF
30 test_expect_success 'Pop middle patch, creating a conflict' '
31 conflict_old stg pop p2 &&
32 stg status a > actual.txt &&
33 test_cmp expected.txt actual.txt &&
34 test "$(echo $(stg series))" = "+ p1 > p3 - p2"
37 test_expect_success 'Try to undo without --hard' '
38 command_error stg undo &&
39 stg status a > actual.txt &&
40 test_cmp expected.txt actual.txt &&
41 test "$(echo $(stg series))" = "+ p1 > p3 - p2"
44 cat > expected.txt <<EOF
46 test_expect_success 'Try to undo with --hard' '
48 stg status a > actual.txt &&
49 test_cmp expected.txt actual.txt &&
50 test "$(echo $(stg series))" = "> p1 - p3 - p2"