1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 09:46:08 +02:00

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
commit 82fafc77ba
2 changed files with 27 additions and 2 deletions

4
dir.c
View File

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

View File

@ -30,6 +30,31 @@ test_expect_success 'same with gitignore starting with BOM' '
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
?? .gitignore
?? actual