From 4059653a2d5ef229fe6c69a016974187bf56ce7d Mon Sep 17 00:00:00 2001 From: Matt Lyons Date: Fri, 14 Oct 2016 17:11:57 -0700 Subject: [PATCH] feat: change ignore rules to match whole name Previously ignore rules would be fuzzy compared (a rule of '.git' would match 'myproject.git') and have unintended consequences. Fixes #916 --- lib/rules/add.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rules/add.js b/lib/rules/add.js index d2e18276..14eb24ee 100644 --- a/lib/rules/add.js +++ b/lib/rules/add.js @@ -82,8 +82,12 @@ 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); } -} \ No newline at end of file +}