mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
Merge branch 'kb/status-ignored-optim-2' into maint
Fix recent regression of .gitignore files that list !directory to mark it not-ignored. * kb/status-ignored-optim-2: dir.c: fix ignore processing within not-ignored directories
This commit is contained in:
commit
fd50030209
2 changed files with 21 additions and 0 deletions
3
dir.c
3
dir.c
|
@ -821,6 +821,9 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
|
|||
dir->basebuf, stk->baselen - 1,
|
||||
dir->basebuf + current, &dt);
|
||||
dir->basebuf[stk->baselen - 1] = '/';
|
||||
if (dir->exclude &&
|
||||
dir->exclude->flags & EXC_FLAG_NEGATIVE)
|
||||
dir->exclude = NULL;
|
||||
if (dir->exclude) {
|
||||
dir->basebuf[stk->baselen] = 0;
|
||||
dir->exclude_stack = stk;
|
||||
|
|
|
@ -175,6 +175,24 @@ test_expect_success 'negated exclude matches can override previous ones' '
|
|||
grep "^a.1" output
|
||||
'
|
||||
|
||||
test_expect_success 'excluded directory overrides content patterns' '
|
||||
|
||||
git ls-files --others --exclude="one" --exclude="!one/a.1" >output &&
|
||||
if grep "^one/a.1" output
|
||||
then
|
||||
false
|
||||
fi
|
||||
'
|
||||
|
||||
test_expect_success 'negated directory doesn'\''t affect content patterns' '
|
||||
|
||||
git ls-files --others --exclude="!one" --exclude="one/a.1" >output &&
|
||||
if grep "^one/a.1" output
|
||||
then
|
||||
false
|
||||
fi
|
||||
'
|
||||
|
||||
test_expect_success 'subdirectory ignore (setup)' '
|
||||
mkdir -p top/l1/l2 &&
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue