Remove the assert in CommitData.parse() function
[stgit] / t / t3400-pick.sh
CommitLineData
eda45dba
CM
1#!/bin/sh
2test_description='Test the pick command'
3
4. ./test-lib.sh
5
6test_expect_success \
7 'Initialize the StGIT repository' \
8 '
9 stg init &&
c7506039
CM
10 stg new A -m "a" && echo A > a && stg add a && stg refresh &&
11 stg new B -m "b" && echo B > b && stg add b && stg refresh &&
eda45dba 12 stg branch --clone foo &&
c7506039
CM
13 stg new C -m "c" && echo C > c && stg add c && stg refresh &&
14 stg new D-foo -m "d" && echo D > d && stg add d && stg refresh &&
eda45dba
CM
15 stg branch master
16 '
17
18test_expect_success \
19 'Pick remote patch' \
20 '
21 stg pick foo:C &&
22 test "$(echo $(stg series --applied --noprefix))" = "A B C"
23 '
24
25test_expect_success \
26 'Pick --unapplied remote patch' \
27 '
28 stg pick --unapplied --ref-branch foo --name D D-foo &&
29 test "$(echo $(stg series --applied --noprefix))" = "A B C" &&
30 test "$(echo $(stg series --unapplied --noprefix))" = "D"
31 '
32
33test_expect_success \
34 'Pick local unapplied patch' \
35 '
36 stg pick D &&
37 test "$(echo $(stg series --applied --noprefix))" = "A B C D-0" &&
38 test "$(echo $(stg series --unapplied --noprefix))" = "D"
39 '
40
41test_expect_success \
b5f9ac87 42 'Pick --fold --revert local patch' \
eda45dba 43 '
b5f9ac87 44 stg pick --fold --revert D &&
eda45dba
CM
45 stg refresh && stg clean &&
46 test "$(echo $(stg series --applied --noprefix))" = "A B C" &&
47 test "$(echo $(stg series --unapplied --noprefix))" = "D"
48 '
49
50test_expect_success \
51 'Pick --fold without applied patches' \
52 '
53 stg pop --all &&
54 stg pick --fold D &&
55 test "$(echo $(stg series --unapplied --noprefix))" = "A B C D" &&
56 test "$(echo $(stg status))" = "A d"
57 '
58
59test_done