Skip to content

Commit f67edfe

Browse files
author
barak igal
authored
Fix Windows compatibility for gitignore option (#171)
1 parent 20bb8ae commit f67edfe

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gitignore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const reduceIgnore = files => {
4848
const ensureAbsolutePathForCwd = (cwd, p) => {
4949
cwd = slash(cwd);
5050
if (path.isAbsolute(p)) {
51-
if (p.startsWith(cwd)) {
51+
if (slash(p).startsWith(cwd)) {
5252
return p;
5353
}
5454

gitignore.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ test('gitignore - mixed path styles', async t => {
1717
t.true(isIgnored(slash(path.resolve(cwd, 'foo.js'))));
1818
});
1919

20+
test('gitignore - os paths', async t => {
21+
const cwd = path.join(__dirname, 'fixtures/gitignore');
22+
const isIgnored = await gitignore({cwd});
23+
t.true(isIgnored(path.resolve(cwd, 'foo.js')));
24+
});
25+
2026
test('gitignore - sync', t => {
2127
const cwd = path.join(__dirname, 'fixtures/gitignore');
2228
const isIgnored = gitignore.sync({cwd});

0 commit comments

Comments
 (0)