Merge branch 'en/fill-directory-exponential' into master

Fix to a regression introduced during 2.27 cycle.

* en/fill-directory-exponential:
  dir: check pathspecs before returning `path_excluded`
This commit is contained in:
Junio C Hamano 2020-07-30 13:20:36 -07:00
Родитель be2dab9c80 cada7308ad
Коммит 82fafc77ba
2 изменённых файлов: 27 добавлений и 2 удалений

4
dir.c
Просмотреть файл

@ -2209,13 +2209,13 @@ static enum path_treatment treat_path(struct dir_struct *dir,
baselen, excluded, pathspec); baselen, excluded, pathspec);
case DT_REG: case DT_REG:
case DT_LNK: case DT_LNK:
if (excluded)
return path_excluded;
if (pathspec && if (pathspec &&
!match_pathspec(istate, pathspec, path->buf, path->len, !match_pathspec(istate, pathspec, path->buf, path->len,
0 /* prefix */, NULL /* seen */, 0 /* prefix */, NULL /* seen */,
0 /* is_dir */)) 0 /* is_dir */))
return path_none; return path_none;
if (excluded)
return path_excluded;
return path_untracked; return path_untracked;
} }
} }

Просмотреть файл

@ -30,6 +30,31 @@ test_expect_success 'same with gitignore starting with BOM' '
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'status untracked files --ignored with pathspec (no match)' '
git status --porcelain --ignored -- untracked/i >actual &&
test_must_be_empty actual &&
git status --porcelain --ignored -- untracked/u >actual &&
test_must_be_empty actual
'
test_expect_success 'status untracked files --ignored with pathspec (literal match)' '
git status --porcelain --ignored -- untracked/ignored >actual &&
echo "!! untracked/ignored" >expected &&
test_cmp expected actual &&
git status --porcelain --ignored -- untracked/uncommitted >actual &&
echo "?? untracked/uncommitted" >expected &&
test_cmp expected actual
'
test_expect_success 'status untracked files --ignored with pathspec (glob match)' '
git status --porcelain --ignored -- untracked/i\* >actual &&
echo "!! untracked/ignored" >expected &&
test_cmp expected actual &&
git status --porcelain --ignored -- untracked/u\* >actual &&
echo "?? untracked/uncommitted" >expected &&
test_cmp expected actual
'
cat >expected <<\EOF cat >expected <<\EOF
?? .gitignore ?? .gitignore
?? actual ?? actual