File: t1205-push-subdir.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 (69 lines) | stat: -rwxr-xr-x 1,784 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
#!/bin/sh
test_description='Test the push command from a subdirectory'
. ./test-lib.sh
stg init

test_expect_success 'Create some patches' '
    mkdir foo
    for i in 0 1 2; do
        stg new p$i -m p$i &&
        echo x$i >> x.txt &&
        echo y$i >> foo/y.txt &&
        stg add x.txt foo/y.txt &&
        stg refresh
    done &&
    [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
    [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'

test_expect_success 'Fast-forward push from a subdir' '
    stg pop &&
    [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
    [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
    cd foo &&
    stg push &&
    cd .. &&
    [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
    [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
'

test_expect_success 'Modifying push from a subdir' '
    stg pop &&
    [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
    [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
    stg new extra -m extra &&
    echo extra >> extra.txt &&
    stg add extra.txt &&
    stg refresh &&
    cd foo &&
    stg push &&
    cd .. &&
    [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
    [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
'

test_expect_success 'Conflicting push from subdir' '
    stg pop p1 p2 &&
    [ "$(echo $(cat x.txt))" = "x0" ] &&
    [ "$(echo $(cat foo/y.txt))" = "y0" ] &&
    cd foo &&
    conflict stg push p2 &&
    cd .. &&
    [ "$(echo $(stg status))" = "UU foo/y.txt UU x.txt" ]
'

test_expect_success 'Conflicting add/unknown file in subdir' '
    stg reset --hard &&
    stg new foo -m foo &&
    mkdir d &&
    echo foo > d/test &&
    stg add d/test &&
    stg refresh &&
    stg pop &&
    mkdir -p d &&
    echo bar > d/test &&
    command_error stg push foo &&
    [ "$(stg top)" != "foo" ]
'

test_done