3 # Copyright (c) 2007 Michael Spang
6 test_description
='git-clean basic tests'
10 test_expect_success
'setup' '
13 touch src/part1.c Makefile &&
14 echo build >.gitignore &&
15 echo \*.o >>.gitignore &&
17 git-commit -m setup &&
18 touch src/part2.c README &&
23 test_expect_success
'git-clean' '
25 mkdir -p build docs &&
26 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
30 test -f src/part1.c &&
31 test -f src/part2.c &&
33 test ! -f src/part3.c &&
34 test -f docs/manual.txt &&
40 test_expect_success
'git-clean src/' '
42 mkdir -p build docs &&
43 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
47 test -f src/part1.c &&
48 test -f src/part2.c &&
50 test ! -f src/part3.c &&
51 test -f docs/manual.txt &&
57 test_expect_success
'git-clean src/ src/' '
59 mkdir -p build docs &&
60 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
61 git-clean src/ src/ &&
64 test -f src/part1.c &&
65 test -f src/part2.c &&
67 test ! -f src/part3.c &&
68 test -f docs/manual.txt &&
74 test_expect_success
'git-clean with prefix' '
76 mkdir -p build docs &&
77 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
78 (cd src/ && git-clean) &&
81 test -f src/part1.c &&
82 test -f src/part2.c &&
84 test ! -f src/part3.c &&
85 test -f docs/manual.txt &&
90 test_expect_success
'git-clean -d with prefix and path' '
92 mkdir -p build docs src/feature &&
93 touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&
94 (cd src/ && git-clean -d feature/) &&
97 test -f src/part1.c &&
98 test -f src/part2.c &&
100 test -f src/part3.c &&
101 test ! -f src/feature/file.c &&
102 test -f docs/manual.txt &&
108 test_expect_success
'git-clean symbolic link' '
110 mkdir -p build docs &&
111 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
112 ln -s docs/manual.txt src/part4.c
116 test -f src/part1.c &&
117 test -f src/part2.c &&
119 test ! -f src/part3.c &&
120 test ! -f src/part4.c &&
121 test -f docs/manual.txt &&
127 test_expect_success
'git-clean -n' '
129 mkdir -p build docs &&
130 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
134 test -f src/part1.c &&
135 test -f src/part2.c &&
137 test -f src/part3.c &&
138 test -f docs/manual.txt &&
144 test_expect_success
'git-clean -d' '
146 mkdir -p build docs &&
147 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
151 test -f src/part1.c &&
152 test -f src/part2.c &&
154 test ! -f src/part3.c &&
161 test_expect_success
'git-clean -d src/ examples/' '
163 mkdir -p build docs examples &&
164 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&
165 git-clean -d src/ examples/ &&
168 test -f src/part1.c &&
169 test -f src/part2.c &&
171 test ! -f src/part3.c &&
172 test ! -f examples/1.c &&
173 test -f docs/manual.txt &&
179 test_expect_success
'git-clean -x' '
181 mkdir -p build docs &&
182 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
186 test -f src/part1.c &&
187 test -f src/part2.c &&
189 test ! -f src/part3.c &&
190 test -f docs/manual.txt &&
196 test_expect_success
'git-clean -d -x' '
198 mkdir -p build docs &&
199 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
203 test -f src/part1.c &&
204 test -f src/part2.c &&
206 test ! -f src/part3.c &&
213 test_expect_success
'git-clean -X' '
215 mkdir -p build docs &&
216 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
220 test -f src/part1.c &&
221 test -f src/part2.c &&
223 test -f src/part3.c &&
224 test -f docs/manual.txt &&
230 test_expect_success
'git-clean -d -X' '
232 mkdir -p build docs &&
233 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
237 test -f src/part1.c &&
238 test -f src/part2.c &&
240 test -f src/part3.c &&
241 test -f docs/manual.txt &&
247 test_expect_success
'clean.requireForce' '
249 git config clean.requireForce true &&
254 test_expect_success
'clean.requireForce and -n' '
256 mkdir -p build docs &&
257 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
261 test -f src/part1.c &&
262 test -f src/part2.c &&
264 test -f src/part3.c &&
265 test -f docs/manual.txt &&
271 test_expect_success
'clean.requireForce and -f' '
275 test -f src/part1.c &&
276 test -f src/part2.c &&
278 test ! -f src/part3.c &&
279 test -f docs/manual.txt &&