File: t1501-sink.sh

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (77 lines) | stat: -rwxr-xr-x 1,996 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh

test_description='Test "stg sink"'

. ./test-lib.sh

test_expect_success 'Initialize StGit stack' '
    echo 0 >> f0 &&
    stg add f0 &&
    git commit -m initial &&
    echo 1 >> f1 &&
    stg add f1 &&
    git commit -m p1 &&
    echo 2 >> f2 &&
    stg add f2 &&
    git commit -m p2 &&
    echo 3 >> f3 &&
    stg add f3 &&
    git commit -m p3 &&
    echo 4 >> f4 &&
    stg add f4 &&
    git commit -m p4 &&
    echo 22 >> f2 &&
    stg add f2 &&
    git commit -m p22 &&
    stg init &&
    stg uncommit p22 p4 p3 p2 p1 &&
    stg pop -a
'

test_expect_success 'sink default without applied patches' '
    command_error stg sink 2>&1 |
    grep -e "No patches to sink"
'

test_expect_success 'sink and reorder specified without applied patches' '
    stg sink p2 p1 &&
    test "$(echo $(stg series --applied --noprefix))" = "p2 p1"
'

test_expect_success 'attempt sink below unapplied' '
    command_error stg sink --to=p4 2>&1 |
    grep -e "Cannot sink below p4 since it is not applied"
'

test_expect_success 'sink patches to the bottom of the stack' '
    stg sink p4 p3 p2 &&
    test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p2 p1"
'

test_expect_success 'sink current below a target' '
    stg sink --to=p2 &&
    test "$(echo $(stg series --applied --noprefix))" = "p4 p3 p1 p2"
'

test_expect_success 'bring patches forward' '
    stg sink --to=p2 p3 p4 &&
    test "$(echo $(stg series --applied --noprefix))" = "p1 p3 p4 p2"
'

test_expect_success 'sink specified patch below a target' '
    stg sink --to=p3 p2 &&
    test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4"
'

test_expect_success 'attempt sink with same to and target' '
    command_error stg sink --to=p3 p3 2>&1 |
    grep -e "Cannot have a sinked patch as target"
'

test_expect_success 'sink with conflict' '
    conflict stg sink --to=p2 p22 &&
    test "$(echo $(stg series --applied --noprefix))" = "p1 p22" &&
    test "$(echo $(stg status))" = "DU f2"
'

test_done