Skip to content

Commit

Permalink
Upgrade ignore package
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebuilds committed May 25, 2019
1 parent c737820 commit 4af038e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion gitignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@ const reduceIgnore = files => {
}, gitIgnore());
};

const ensureAbsolutePathForCwd = (cwd, p) => {
if (path.isAbsolute(p)) {
if (p.startsWith(cwd)) {
return p;
}

throw new Error(`Path ${p} is not in cwd ${cwd}`);
}

return path.join(cwd, p);
};

const getIsIgnoredPredecate = (ignores, cwd) => {
return p => ignores.ignores(slash(path.relative(cwd, p)));
return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p))));
};

const getFile = (file, cwd) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"dir-glob": "^2.2.2",
"fast-glob": "^2.2.6",
"glob": "^7.1.3",
"ignore": "^4.0.3",
"ignore": "^5.1.1",
"pify": "^4.0.1",
"slash": "^2.0.0"
},
Expand Down

0 comments on commit 4af038e

Please sign in to comment.