Test for generated patchname with trailing period
[stgit.git] / t / t1501-sink.sh
blob2227a7772c5bf8b3789f08817febdef9421b0799
1 #!/bin/sh
3 test_description='Test "stg sink"'
5 . ./test-lib.sh
7 test_expect_success 'Initialize StGit stack' '
8 echo 0 >> f0 &&
9 stg add f0 &&
10 git commit -m initial &&
11 echo 1 >> f1 &&
12 stg add f1 &&
13 git commit -m p1 &&
14 echo 2 >> f2 &&
15 stg add f2 &&
16 git commit -m p2 &&
17 echo 3 >> f3 &&
18 stg add f3 &&
19 git commit -m p3 &&
20 echo 4 >> f4 &&
21 stg add f4 &&
22 git commit -m p4 &&
23 echo 22 >> f2 &&
24 stg add f2 &&
25 git commit -m p22 &&
26 stg init &&
27 stg uncommit p22 p4 p3 p2 p1 &&
28 stg pop -a
31 test_expect_success 'sink default without applied patches' '
32 command_error stg sink 2>&1 |
33 grep -e "No patches to sink"
36 test_expect_success 'sink and reorder specified without applied patches' '
37 stg sink p2 p1 &&
38 test "$(echo $(stg series --applied --noprefix))" = "p2 p1"
41 test_expect_success 'attempt sink below unapplied' '
42 command_error stg sink --to=p4 2>&1 |
43 grep -e "Cannot sink below p4 since it is not applied"
46 test_expect_success 'sink patches to the bottom of the stack' '
47 stg sink p4 p3 p2 &&
48 test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p2 p1"
51 test_expect_success 'sink current below a target' '
52 stg sink --to=p2 &&
53 test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p1 p2"
56 test_expect_success 'bring patches forward' '
57 stg sink --to=p2 p3 p4 &&
58 test "$(echo $(stg series --applied --noprefix))" = "p1 p3 p4 p2"
61 test_expect_success 'sink specified patch below a target' '
62 stg sink --to=p3 p2 &&
63 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4"
66 test_expect_success 'attempt sink with same to and target' '
67 command_error stg sink --to=p3 p3 2>&1 |
68 grep -e "Cannot have a sinked patch as target"
71 test_expect_success 'sink with conflict' '
72 conflict stg sink --to=p2 p22 &&
73 test "$(echo $(stg series --applied --noprefix))" = "p1 p22" &&
74 test "$(echo $(stg status))" = "DU f2"
77 test_done