Skip to content

Commit

Permalink
feat: change ignore rules to match whole name
Browse files Browse the repository at this point in the history
Previously ignore rules would be fuzzy compared (a rule of '.git' would match 'myproject.git') and have unintended consequences.
Fixes remy#916
  • Loading branch information
mattlyons0 committed Oct 15, 2016
1 parent 2cd85b1 commit 815cc0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rules/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ function add(rules, which, rule) {
return rule.replace(reEscapeChars, '\\$&')
.replace(reAsterisk, '.*');
}).join('|');
// Only match if a '\', '/' or nothing comes before item
// Additionally only match if a '\', '/' or nothing comes after the item
re = '(\\/|\\\\|^)(' + re + ')($|\\/|\\\\)';

// used for the directory matching
rules[which].re = new RegExp(re);
}
}
}

0 comments on commit 815cc0b

Please sign in to comment.