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 series --applied --noprefix))" = "p0 p1 p2" ] &&
15 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
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 series --applied --noprefix))" = "p0" ] &&
25 [ "$(echo $(stg series --unapplied --noprefix))" = "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 series --applied --noprefix))" = "p0 p1" ] &&
38 [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
39 [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]