Skip to content

Commit

Permalink
Prune ignored paths earlier to save unnecessary work
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Jul 26, 2016
1 parent c2f6ccc commit 4a2fc7c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ function _walkSync(baseDir, options, _relativePath) {
var names = fs.readdirSync(baseDir + '/' + relativePath);
var entries = names.map(function (name) {
var entryRelativePath = relativePath + name;

if (ignoreMatcher && ignoreMatcher.match(entryRelativePath)) {
return;
}

var fullPath = baseDir + '/' + entryRelativePath;
var stats = getStat(fullPath);

Expand All @@ -89,9 +94,6 @@ function _walkSync(baseDir, options, _relativePath) {

for (var i=0; i<sortedEntries.length; ++i) {
var entry = sortedEntries[i];
if (ignoreMatcher && ignoreMatcher.match(entry.relativePath)) {
continue;
}

if (entry.isDirectory()) {
if (options.directories !== false && (!globMatcher || globMatcher.match(entry.relativePath))) {
Expand Down

0 comments on commit 4a2fc7c

Please sign in to comment.