Documentation/user-manual.txt: fix typo
[alt-git.git] / t / t7300-clean.sh
blob0ed4ae282728a1701a8d67ae16572db14f1dee69
1 #!/bin/sh
3 # Copyright (c) 2007 Michael Spang
6 test_description='git-clean basic tests'
8 . ./test-lib.sh
10 test_expect_success 'setup' '
12 mkdir -p src &&
13 touch src/part1.c Makefile &&
14 echo build >.gitignore &&
15 echo \*.o >>.gitignore &&
16 git add . &&
17 git-commit -m setup &&
18 touch src/part2.c README &&
19 git add .
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 &&
27 git-clean &&
28 test -f Makefile &&
29 test -f README &&
30 test -f src/part1.c &&
31 test -f src/part2.c &&
32 test ! -f a.out &&
33 test ! -f src/part3.c &&
34 test -f docs/manual.txt &&
35 test -f obj.o &&
36 test -f build/lib.so
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 &&
44 git-clean -n &&
45 test -f Makefile &&
46 test -f README &&
47 test -f src/part1.c &&
48 test -f src/part2.c &&
49 test -f a.out &&
50 test -f src/part3.c &&
51 test -f docs/manual.txt &&
52 test -f obj.o &&
53 test -f build/lib.so
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 &&
61 git-clean -d &&
62 test -f Makefile &&
63 test -f README &&
64 test -f src/part1.c &&
65 test -f src/part2.c &&
66 test ! -f a.out &&
67 test ! -f src/part3.c &&
68 test ! -d docs &&
69 test -f obj.o &&
70 test -f build/lib.so
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 &&
78 git-clean -x &&
79 test -f Makefile &&
80 test -f README &&
81 test -f src/part1.c &&
82 test -f src/part2.c &&
83 test ! -f a.out &&
84 test ! -f src/part3.c &&
85 test -f docs/manual.txt &&
86 test ! -f obj.o &&
87 test -f build/lib.so
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 &&
95 git-clean -d -x &&
96 test -f Makefile &&
97 test -f README &&
98 test -f src/part1.c &&
99 test -f src/part2.c &&
100 test ! -f a.out &&
101 test ! -f src/part3.c &&
102 test ! -d docs &&
103 test ! -f obj.o &&
104 test ! -d build
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 &&
112 git-clean -X &&
113 test -f Makefile &&
114 test -f README &&
115 test -f src/part1.c &&
116 test -f src/part2.c &&
117 test -f a.out &&
118 test -f src/part3.c &&
119 test -f docs/manual.txt &&
120 test ! -f obj.o &&
121 test -f build/lib.so
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 &&
129 git-clean -d -X &&
130 test -f Makefile &&
131 test -f README &&
132 test -f src/part1.c &&
133 test -f src/part2.c &&
134 test -f a.out &&
135 test -f src/part3.c &&
136 test -f docs/manual.txt &&
137 test ! -f obj.o &&
138 test ! -d build
142 test_expect_success 'clean.requireForce' '
144 git config clean.requireForce true &&
145 ! git-clean
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 &&
153 git-clean -n &&
154 test -f Makefile &&
155 test -f README &&
156 test -f src/part1.c &&
157 test -f src/part2.c &&
158 test -f a.out &&
159 test -f src/part3.c &&
160 test -f docs/manual.txt &&
161 test -f obj.o &&
162 test -f build/lib.so
166 test_expect_success 'clean.requireForce and -f' '
168 git-clean -f &&
169 test -f README &&
170 test -f src/part1.c &&
171 test -f src/part2.c &&
172 test ! -f a.out &&
173 test ! -f src/part3.c &&
174 test -f docs/manual.txt &&
175 test -f obj.o &&
176 test -f build/lib.so
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
191 test_done