3 test_description
='Simple test cases for "stg reset"'
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 test_expect_success
'Invalid arguments' '
28 command_error stg reset 2>&1 |
29 grep -e "Wrong options"
32 cat > expected.txt
<<EOF
35 test_expect_success
'Pop middle patch, creating a conflict' '
36 conflict stg pop p2 &&
37 stg status a > actual.txt &&
38 test_cmp expected.txt actual.txt &&
39 test "$(echo $(stg series))" = "+ p1 > p3 - p2"
42 test_expect_success
'Try to reset without --hard' '
43 command_error stg reset refs/stacks/master^~1 &&
44 stg status a > actual.txt &&
45 test_cmp expected.txt actual.txt &&
46 test "$(echo $(stg series))" = "+ p1 > p3 - p2"
49 cat > expected.txt
<<EOF
51 test_expect_success
'Try to reset with --hard' '
52 stg reset --hard refs/stacks/master^~1 &&
53 stg status a > actual.txt &&
54 test_cmp expected.txt actual.txt &&
55 test "$(echo $(stg series))" = "+ p1 + p2 > p3"