Skip to content

Commit

Permalink
Improve handling of .gitignore files. (#306)
Browse files Browse the repository at this point in the history
* Omit comments from list of patterns.
* Support .gitignore files with \r\n linebreaks.
  • Loading branch information
amanda-mitchell authored and fkling committed Mar 6, 2019
1 parent 6dd0eba commit ec3ab98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ignoreFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const matchers = [];
* @see {@linkplain https://git-scm.com/docs/gitignore#_pattern_format}
*/
function addIgnorePattern(val) {
if (val && typeof val === 'string') {
if (val && typeof val === 'string' && val[0] !== '#') {
let pattern = val;
if (pattern.indexOf('/') === -1) {
matchers.push('**/' + pattern);
Expand Down Expand Up @@ -51,7 +51,7 @@ function addIgnoreFromFile(input) {
const stats = fs.statSync(config);
if (stats.isFile()) {
const content = fs.readFileSync(config, 'utf8');
lines = lines.concat(content.split('\n'));
lines = lines.concat(content.split(/\r?\n/));
}
});

Expand Down

0 comments on commit ec3ab98

Please sign in to comment.