Skip to content

Commit 82fafc7

Browse files
committed
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`
2 parents be2dab9 + cada730 commit 82fafc7

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,13 +2209,13 @@ static enum path_treatment treat_path(struct dir_struct *dir,
22092209
baselen, excluded, pathspec);
22102210
case DT_REG:
22112211
case DT_LNK:
2212-
if (excluded)
2213-
return path_excluded;
22142212
if (pathspec &&
22152213
!match_pathspec(istate, pathspec, path->buf, path->len,
22162214
0 /* prefix */, NULL /* seen */,
22172215
0 /* is_dir */))
22182216
return path_none;
2217+
if (excluded)
2218+
return path_excluded;
22192219
return path_untracked;
22202220
}
22212221
}

t/t7061-wtstatus-ignore.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,31 @@ test_expect_success 'same with gitignore starting with BOM' '
3030
test_cmp expected actual
3131
'
3232

33+
test_expect_success 'status untracked files --ignored with pathspec (no match)' '
34+
git status --porcelain --ignored -- untracked/i >actual &&
35+
test_must_be_empty actual &&
36+
git status --porcelain --ignored -- untracked/u >actual &&
37+
test_must_be_empty actual
38+
'
39+
40+
test_expect_success 'status untracked files --ignored with pathspec (literal match)' '
41+
git status --porcelain --ignored -- untracked/ignored >actual &&
42+
echo "!! untracked/ignored" >expected &&
43+
test_cmp expected actual &&
44+
git status --porcelain --ignored -- untracked/uncommitted >actual &&
45+
echo "?? untracked/uncommitted" >expected &&
46+
test_cmp expected actual
47+
'
48+
49+
test_expect_success 'status untracked files --ignored with pathspec (glob match)' '
50+
git status --porcelain --ignored -- untracked/i\* >actual &&
51+
echo "!! untracked/ignored" >expected &&
52+
test_cmp expected actual &&
53+
git status --porcelain --ignored -- untracked/u\* >actual &&
54+
echo "?? untracked/uncommitted" >expected &&
55+
test_cmp expected actual
56+
'
57+
3358
cat >expected <<\EOF
3459
?? .gitignore
3560
?? actual

0 commit comments

Comments
 (0)