Skip to content

Commit 04d51bf

Browse files
jamiekyle-ebsindresorhus
authored andcommitted
Upgrade ignore package (#120)
1 parent 2b61484 commit 04d51bf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

gitignore.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,20 @@ const reduceIgnore = files => {
4444
}, gitIgnore());
4545
};
4646

47+
const ensureAbsolutePathForCwd = (cwd, p) => {
48+
if (path.isAbsolute(p)) {
49+
if (p.startsWith(cwd)) {
50+
return p;
51+
}
52+
53+
throw new Error(`Path ${p} is not in cwd ${cwd}`);
54+
}
55+
56+
return path.join(cwd, p);
57+
};
58+
4759
const getIsIgnoredPredecate = (ignores, cwd) => {
48-
return p => ignores.ignores(slash(path.relative(cwd, p)));
60+
return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p))));
4961
};
5062

5163
const getFile = (file, cwd) => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"dir-glob": "^2.2.2",
6262
"fast-glob": "^2.2.6",
6363
"glob": "^7.1.3",
64-
"ignore": "^4.0.3",
64+
"ignore": "^5.1.1",
6565
"pify": "^4.0.1",
6666
"slash": "^2.0.0"
6767
},

0 commit comments

Comments
 (0)