File: t2300-refresh-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 (75 lines) | stat: -rwxr-xr-x 1,818 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
test_description='Test the refresh command from a subdirectory'
. ./test-lib.sh
stg init

test_expect_success 'Refresh from a subdirectory' '
    stg new p0 -m p0 &&
    echo foo >> foo.txt &&
    mkdir bar &&
    echo bar >> bar/bar.txt &&
    stg add foo.txt bar/bar.txt &&
    cd bar &&
    stg refresh &&
    cd .. &&
    [ "$(stg status)" = "" ]
'

test_expect_success 'Refresh again' '
    echo foo2 >> foo.txt &&
    echo bar2 >> bar/bar.txt &&
    cd bar &&
    stg refresh &&
    cd .. &&
    [ "$(stg status)" = "" ]
'

test_expect_success 'Refresh file in subdirectory' '
    echo foo3 >> foo.txt &&
    echo bar3 >> bar/bar.txt &&
    cd bar &&
    stg refresh bar.txt &&
    cd .. &&
    [ "$(stg status)" = " M foo.txt" ]
'

test_expect_success 'Refresh whole subdirectory' '
    echo bar4 >> bar/bar.txt &&
    stg refresh bar &&
    [ "$(stg status)" = " M foo.txt" ]
'

test_expect_success 'Refresh subdirectories recursively' '
    echo bar5 >> bar/bar.txt &&
    stg refresh . &&
    [ "$(stg status)" = "" ]
'

test_expect_success 'refresh -u' '
    echo baz >> bar/baz.txt &&
    stg new p1 -m p1 &&
    stg add bar/baz.txt &&
    stg refresh --index &&
    echo xyzzy >> foo.txt &&
    echo xyzzy >> bar/bar.txt &&
    echo xyzzy >> bar/baz.txt &&
    stg refresh -u &&
    test "$(echo $(stg status))" = "M bar/bar.txt M foo.txt"
'

test_expect_success 'refresh -u -p <subdir>' '
    echo xyzzy >> bar/baz.txt &&
    stg refresh -p p0 -u bar &&
    test "$(echo $(stg status))" = "M bar/baz.txt M foo.txt"
'

test_expect_success 'refresh an unapplied patch' '
    stg refresh -u &&
    stg goto --keep p0 &&
    test "$(stg status)" = " M foo.txt" &&
    stg refresh -p p1 &&
    test "$(stg status)" = "" &&
    test "$(echo $(stg files p1))" = "A bar/baz.txt M foo.txt"
'

test_done