Skip to content

Commit

Permalink
Do not ignore pattern start with ./
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed May 15, 2024
1 parent b0d7330 commit c82aff8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions fixtures/gitignore/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
foo.js
!bar.js
./baz.js
2 changes: 1 addition & 1 deletion ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const parseIgnoreFile = (file, cwd) => {

return file.content
.split(/\r?\n/)
.filter(line => line && !line.startsWith('#'))
.filter(line => line && !line.startsWith('#') && !line.startsWith('./') && !line.startsWith('../'))
.map(pattern => applyBaseToPattern(pattern, base));
};

Expand Down
4 changes: 2 additions & 2 deletions tests/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ test('ignore', async t => {
const actual = await runIsGitIgnored(
t,
{cwd},
isIgnored => ['foo.js', 'bar.js'].filter(file => !isIgnored(file)),
isIgnored => ['foo.js', 'bar.js', 'baz.js'].filter(file => !isIgnored(file)),
);
const expected = ['bar.js'];
const expected = ['bar.js', 'baz.js'];
t.deepEqual(actual, expected);
}
});
Expand Down

0 comments on commit c82aff8

Please sign in to comment.