3 test_description
='Test "stg pop -keep"'
7 test_expect_success
'Create a few patches' '
10 echo "patch$i" >> patch$i.txt &&
11 stg add patch$i.txt &&
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' '
35 test_expect_success
'Pop a patch without local changes' '
37 [ "$(echo $(stg applied))" = "p0 p1" ] &&
38 [ "$(echo $(stg unapplied))" = "p2" ] &&
39 [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]