3 test_description
='Test "stg sink"'
7 test_expect_success
'Initialize StGit stack' '
10 git commit -m initial &&
27 stg uncommit p22 p4 p3 p2 p1 &&
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' '
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' '
48 test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p2 p1"
51 test_expect_success
'sink current below a target' '
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"