chiark / gitweb /
stgit.el: Add "d" for a few diff commands, similar to git.el
[stgit] / t / t1501-sink.sh
CommitLineData
205b1af9
KH
1#!/bin/sh
2
3test_description='Test "stg sink"'
4
5. ./test-lib.sh
6
7test_expect_success 'Initialize StGit stack' '
8bcdcdc9
CM
8 echo 0 >> f0 &&
9 git add f0 &&
205b1af9 10 git commit -m initial &&
8bcdcdc9
CM
11 echo 1 >> f1 &&
12 git add f1 &&
13 git commit -m p1 &&
14 echo 2 >> f2 &&
15 git add f2 &&
16 git commit -m p2 &&
17 echo 3 >> f3 &&
18 git add f3 &&
19 git commit -m p3 &&
20 echo 4 >> f4 &&
21 git add f4 &&
22 git commit -m p4 &&
23 echo 22 >> f2 &&
24 git add f2 &&
25 git commit -m p22 &&
205b1af9 26 stg init &&
8bcdcdc9
CM
27 stg uncommit p22 p4 p3 p2 p1 &&
28 stg pop -a
205b1af9
KH
29'
30
8bcdcdc9 31test_expect_success 'sink default without applied patches' '
f03004e2 32 command_error stg sink
205b1af9
KH
33'
34
8bcdcdc9
CM
35test_expect_success 'sink and reorder specified without applied patches' '
36 stg sink p2 p1 &&
3ce5fec2 37 test "$(echo $(stg series --applied --noprefix))" = "p2 p1"
8bcdcdc9
CM
38'
39
40test_expect_success 'sink patches to the bottom of the stack' '
41 stg sink p4 p3 p2 &&
3ce5fec2 42 test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p2 p1"
8bcdcdc9
CM
43'
44
45test_expect_success 'sink current below a target' '
46 stg sink --to=p2 &&
3ce5fec2 47 test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p1 p2"
8bcdcdc9
CM
48'
49
50test_expect_success 'bring patches forward' '
51 stg sink --to=p2 p3 p4 &&
3ce5fec2 52 test "$(echo $(stg series --applied --noprefix))" = "p1 p3 p4 p2"
8bcdcdc9
CM
53'
54
55test_expect_success 'sink specified patch below a target' '
56 stg sink --to=p3 p2 &&
3ce5fec2 57 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4"
8bcdcdc9
CM
58'
59
60test_expect_success 'sink with conflict' '
54ab5bde 61 conflict stg sink --to=p2 p22 &&
3ce5fec2 62 test "$(echo $(stg series --applied --noprefix))" = "p1 p22" &&
8bcdcdc9 63 test "$(echo $(stg status -c))" = "f2"
205b1af9
KH
64'
65
66test_done