Skip to content

Commit 472e746

Browse files
committed
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 <[email protected]>
1 parent d6f8fd0 commit 472e746

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

t/t3001-ls-files-others-exclude.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,43 @@ test_expect_success 'negated exclude matches can override previous ones' '
153153
grep "^a.1" output
154154
'
155155

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+
156195
test_done

0 commit comments

Comments
 (0)