Allow only certain gitk exit codes as valid
[stgit.git] / t / t1204-pop-keep.sh
blob40cd2a2aa33bc16f6fb3f010a47d3352c80effd3
1 #!/bin/sh
3 test_description='Test "stg pop -keep"'
4 . ./test-lib.sh
5 stg init
7 test_expect_success 'Create a few patches' '
8 for i in 0 1 2; do
9 stg new p$i -m p$i &&
10 echo "patch$i" >> patch$i.txt &&
11 stg add patch$i.txt &&
12 stg refresh
13 done &&
14 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
15 [ "$(echo $(stg unapplied))" = "" ]
18 test_expect_success 'Make some non-conflicting local changes' '
19 echo "local" >> patch0.txt
22 test_expect_success 'Pop two patches, keeping local changes' '
23 stg pop -n 2 --keep &&
24 [ "$(echo $(stg applied))" = "p0" ] &&
25 [ "$(echo $(stg unapplied))" = "p1 p2" ] &&
26 [ "$(echo $(ls patch?.txt))" = "patch0.txt" ] &&
27 [ "$(echo $(cat patch0.txt))" = "patch0 local" ]
30 test_expect_success 'Reset and push patches again' '
31 git reset --hard &&
32 stg push -a
35 test_expect_success 'Pop a patch without local changes' '
36 stg pop --keep &&
37 [ "$(echo $(stg applied))" = "p0 p1" ] &&
38 [ "$(echo $(stg unapplied))" = "p2" ] &&
39 [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]
42 test_done