t3001: test ls-files -o ignored/dir
When you have "t" directory that is marked as ignored in the top-level .gitignore file (or $GIT_DIR/info/exclude), running $ git ls-files -o --exclude-standard from the top-level correctly excludes files in "t" directory, but any of the following: $ git ls-files -o --exclude-standard t/ $ cd t && git ls-files -o --exclude-standard would show untracked files in that directory. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jan 8, 2010 at 23:07 UTC
472e746991db09fea7f11e4cb856c2cec9dc282b
1 file changed
+39
t/t3001-ls-files-others-exclude.sh
+39
@@ -153,4 +153,43 @@ test_expect_success 'negated exclude matches can override previous ones' '
153
grep "^a.1" output
154
'
155
156
+test_expect_success 'subdirectory ignore (setup)' '
157
+ mkdir -p top/l1/l2 &&
158
+ (
159
+ cd top &&
160
+ git init &&
161
+ echo /.gitignore >.gitignore &&
162
+ echo l1 >>.gitignore &&
163
+ echo l2 >l1/.gitignore &&
164
+ >l1/l2/l1
165
+ )
166
+'
167
+
168
+test_expect_success 'subdirectory ignore (toplevel)' '
169
+ (
170
+ cd top &&
171
+ git ls-files -o --exclude-standard
172
+ ) >actual &&
173
+ >expect &&
174
+ test_cmp expect actual
175
+'
176
+
177
+test_expect_success 'subdirectory ignore (l1/l2)' '
178
+ (
179
+ cd top/l1/l2 &&
180
+ git ls-files -o --exclude-standard
181
+ ) >actual &&
182
+ >expect &&
183
+ test_cmp expect actual
184
+'
185
+
186
+test_expect_failure 'subdirectory ignore (l1)' '
187
+ (
188
+ cd top/l1 &&
189
+ git ls-files -o --exclude-standard
190
+ ) >actual &&
191
+ >expect &&
192
+ test_cmp expect actual
193
+'
194
+
195
test_done