debian/rules should be producing architecture independent packages
[stgit/dwhite.git] / t / t0002-status.sh
blobac92aa8a059a5273ec83a78a479ca4f5486137b3
1 #!/bin/sh
3 # Copyright (c) 2007 David Kågedal
6 test_description='Basic stg status
8 Test that "stg status" works.'
10 . ./test-lib.sh
11 stg init
13 # Ignore our own output files.
14 cat > .git/info/exclude <<EOF
15 /expected.txt
16 /output.txt
17 EOF
19 cat > expected.txt <<EOF
20 EOF
21 test_expect_success 'Run status on empty' '
22 stg status > output.txt &&
23 test_cmp expected.txt output.txt
26 cat > expected.txt <<EOF
27 ? foo
28 EOF
29 test_expect_success 'Status with an untracked file' '
30 touch foo &&
31 stg status > output.txt &&
32 test_cmp expected.txt output.txt
34 rm -f foo
36 cat > expected.txt <<EOF
37 EOF
38 test_expect_success 'Status with an empty directory' '
39 mkdir foo &&
40 stg status > output.txt &&
41 test_cmp expected.txt output.txt
44 cat > expected.txt <<EOF
45 ? foo/
46 EOF
47 test_expect_success 'Status with an untracked file in a subdir' '
48 touch foo/bar &&
49 stg status > output.txt &&
50 test_cmp expected.txt output.txt
53 cat > expected.txt <<EOF
54 A foo/bar
55 EOF
56 test_expect_success 'Status with an added file' '
57 git add foo &&
58 stg status > output.txt &&
59 test_cmp expected.txt output.txt
62 cat > expected.txt <<EOF
63 foo/bar
64 EOF
65 test_expect_success 'Status with an added file and -n option' '
66 stg status -n > output.txt &&
67 test_cmp expected.txt output.txt
70 cat > expected.txt <<EOF
71 EOF
72 test_expect_success 'Status after refresh' '
73 stg new -m "first patch" &&
74 stg refresh &&
75 stg status > output.txt &&
76 test_cmp expected.txt output.txt
79 cat > expected.txt <<EOF
80 M foo/bar
81 EOF
82 test_expect_success 'Status after modification' '
83 echo "wee" >> foo/bar &&
84 stg status > output.txt &&
85 test_cmp expected.txt output.txt
88 cat > expected.txt <<EOF
89 EOF
90 test_expect_success 'Status after refresh' '
91 stg new -m "second patch" && stg refresh &&
92 stg status > output.txt &&
93 test_cmp expected.txt output.txt
96 test_expect_success 'Add another file' '
97 echo lajbans > fie &&
98 git add fie &&
99 stg refresh
102 test_expect_success 'Make a conflicting patch' '
103 stg pop &&
104 stg new -m "third patch" &&
105 echo "woo" >> foo/bar &&
106 stg refresh
109 cat > expected.txt <<EOF
110 ? foo/bar.ancestor
111 ? foo/bar.current
112 ? foo/bar.patched
113 A fie
114 C foo/bar
116 test_expect_success 'Status after conflicting push' '
117 conflict_old stg push &&
118 stg status > output.txt &&
119 test_cmp expected.txt output.txt
122 cat > expected.txt <<EOF
123 C foo/bar
125 test_expect_success 'Status of file' '
126 stg status foo/bar > output.txt &&
127 test_cmp expected.txt output.txt
130 cat > expected.txt <<EOF
131 C foo/bar
133 test_expect_success 'Status of dir' '
134 stg status foo > output.txt &&
135 test_cmp expected.txt output.txt
138 cat > expected.txt <<EOF
139 A fie
141 test_expect_success 'Status of other file' '
142 stg status fie > output.txt &&
143 test_cmp expected.txt output.txt
146 cat > expected.txt <<EOF
147 A fie
148 M foo/bar
150 test_expect_success 'Status after resolving the push' '
151 stg resolved -a &&
152 stg status > output.txt &&
153 test_cmp expected.txt output.txt
156 cat > expected.txt <<EOF
157 A fie
158 D foo/bar
160 test_expect_success 'Status after deleting a file' '
161 rm foo/bar &&
162 stg status > output.txt &&
163 test_cmp expected.txt output.txt
166 cat > expected.txt <<EOF
167 D foo/bar
169 test_expect_success 'Status of disappeared newborn' '
170 stg refresh &&
171 touch foo/bar &&
172 git add foo/bar &&
173 rm foo/bar &&
174 stg status > output.txt &&
175 test_cmp expected.txt output.txt
178 cat > expected.txt <<EOF
179 A fay
180 D fie
182 test_expect_success 'Status after renaming a file' '
183 git rm foo/bar &&
184 git mv fie fay &&
185 stg status > output.txt &&
186 test_cmp expected.txt output.txt
189 test_expect_success 'Status after renaming a file (with rename detection)' '
190 git config stgit.diff-opts -M &&
191 stg status > output.txt &&
192 test_cmp expected.txt output.txt
195 test_done