chiark / gitweb /
Fix typo
[stgit] / t / t1501-sink.sh
1 #!/bin/sh
2
3 test_description='Test "stg sink"'
4
5 . ./test-lib.sh
6
7 test_expect_success 'Initialize StGit stack' '
8     echo 0 >> f0 &&
9     git add f0 &&
10     git commit -m initial &&
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 &&
26     stg init &&
27     stg uncommit p22 p4 p3 p2 p1 &&
28     stg pop -a
29 '
30
31 test_expect_success 'sink default without applied patches' '
32     ! stg sink
33 '
34
35 test_expect_success 'sink and reorder specified without applied patches' '
36     stg sink p2 p1 &&
37     test "$(echo $(stg applied))" = "p2 p1"
38 '
39
40 test_expect_success 'sink patches to the bottom of the stack' '
41     stg sink p4 p3 p2 &&
42     test "$(echo $(stg applied))" = "p4 p3 p2 p1"
43 '
44
45 test_expect_success 'sink current below a target' '
46     stg sink --to=p2 &&
47     test "$(echo $(stg applied))" = "p4 p3 p1 p2"
48 '
49
50 test_expect_success 'bring patches forward' '
51     stg sink --to=p2 p3 p4 &&
52     test "$(echo $(stg applied))" = "p1 p3 p4 p2"
53 '
54
55 test_expect_success 'sink specified patch below a target' '
56     stg sink --to=p3 p2 &&
57     test "$(echo $(stg applied))" = "p1 p2 p3 p4"
58 '
59
60 test_expect_success 'sink with conflict' '
61     ! stg sink --to=p2 p22 &&
62     test "$(echo $(stg applied))" = "p1 p22" &&
63     test "$(echo $(stg status -c))" = "f2"
64 '
65
66 test_done