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 -n' '
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 -d' '
59 mkdir -p build docs &&
60 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
64 test -f src/part1.c &&
65 test -f src/part2.c &&
67 test ! -f src/part3.c &&
74 test_expect_success
'git-clean -x' '
76 mkdir -p build docs &&
77 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
81 test -f src/part1.c &&
82 test -f src/part2.c &&
84 test ! -f src/part3.c &&
85 test -f docs/manual.txt &&
91 test_expect_success
'git-clean -d -x' '
93 mkdir -p build docs &&
94 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
98 test -f src/part1.c &&
99 test -f src/part2.c &&
101 test ! -f src/part3.c &&
108 test_expect_success
'git-clean -X' '
110 mkdir -p build docs &&
111 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
115 test -f src/part1.c &&
116 test -f src/part2.c &&
118 test -f src/part3.c &&
119 test -f docs/manual.txt &&
125 test_expect_success
'git-clean -d -X' '
127 mkdir -p build docs &&
128 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
132 test -f src/part1.c &&
133 test -f src/part2.c &&
135 test -f src/part3.c &&
136 test -f docs/manual.txt &&
142 test_expect_success
'clean.requireForce' '
144 git config clean.requireForce true &&
149 test_expect_success
'clean.requireForce and -n' '
151 mkdir -p build docs &&
152 touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
156 test -f src/part1.c &&
157 test -f src/part2.c &&
159 test -f src/part3.c &&
160 test -f docs/manual.txt &&
166 test_expect_success
'clean.requireForce and -f' '
170 test -f src/part1.c &&
171 test -f src/part2.c &&
173 test ! -f src/part3.c &&
174 test -f docs/manual.txt &&
180 test_expect_success
'core.excludesfile' '
182 echo excludes >excludes &&
183 echo included >included &&
184 git config core.excludesfile excludes &&
185 output=$(git clean -n excludes included 2>&1) &&
186 expr "$output" : ".*included" >/dev/null &&
187 ! expr "$output" : ".*excludes" >/dev/null