Tests redirect to err file when grepping stderr
[stgit.git] / t / t1211-pop-keep.sh
blobd17a1bf8fa497a4a8787bab92e2074dcba250f87
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 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' '
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 series --applied --noprefix))" = "p0 p1" ] &&
38 [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
39 [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]
42 test_done