Skip to content

Commit

Permalink
Merge branch 'en/fill-directory-exponential' into master
Browse files Browse the repository at this point in the history
Fix to a regression introduced during 2.27 cycle.

* en/fill-directory-exponential:
  dir: check pathspecs before returning `path_excluded`
  • Loading branch information
gitster committed Jul 30, 2020
2 parents be2dab9 + cada730 commit 82fafc7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
25 changes: 25 additions & 0 deletions t/t7061-wtstatus-ignore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82fafc7

Please sign in to comment.