Remove the assert in CommitData.parse() function
[stgit] / t / t3103-undo-hard.sh
CommitLineData
069a1e95
KH
1#!/bin/sh
2
3test_description='Simple test cases for "stg undo"'
4
5. ./test-lib.sh
6
7# Ignore our own output files.
8cat > .git/info/exclude <<EOF
9/expected.txt
10/actual.txt
11EOF
12
13test_expect_success 'Initialize StGit stack with three patches' '
14 stg init &&
15 echo 000 >> a &&
c7506039 16 stg add a &&
069a1e95
KH
17 git commit -m a &&
18 echo 111 >> a &&
19 git commit -a -m p1 &&
20 echo 222 >> a &&
21 git commit -a -m p2 &&
22 echo 333 >> a &&
23 git commit -a -m p3 &&
08a1d356
GH
24 stg uncommit -n 3 &&
25 test "$(stg id)" = "$(stg id $(stg top))"
069a1e95
KH
26'
27
28cat > expected.txt <<EOF
29C a
30EOF
31test_expect_success 'Pop middle patch, creating a conflict' '
1056440b 32 conflict stg pop p2 &&
069a1e95
KH
33 stg status a > actual.txt &&
34 test_cmp expected.txt actual.txt &&
08a1d356
GH
35 test "$(echo $(stg series))" = "+ p1 > p3 - p2" &&
36 test "$(stg id)" = "$(stg id $(stg top))"
069a1e95
KH
37'
38
39test_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 &&
08a1d356
GH
43 test "$(echo $(stg series))" = "+ p1 > p3 - p2" &&
44 test "$(stg id)" = "$(stg id $(stg top))"
069a1e95
KH
45'
46
47cat > expected.txt <<EOF
48EOF
ba52890d 49test_expect_success 'Try to undo with --hard' '
069a1e95
KH
50 stg undo --hard &&
51 stg status a > actual.txt &&
52 test_cmp expected.txt actual.txt &&
ba52890d 53 test "$(echo $(stg series))" = "+ p1 + p2 > p3" &&
08a1d356 54 test "$(stg id)" = "$(stg id $(stg top))"
069a1e95
KH
55'
56
57test_done