Skip to content

Commit

Permalink
Ignore gitattributes comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Mar 8, 2024
1 parent 6e39deb commit 3ddd8dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Next
- Fixed gitattributes comments being parsed as attributes data.

### 2.7.0-pre
- Added CLI option `--listFiles` to list each matching file under each language result.
- Fixed files that are by default marked vendored being removed even when marked as not vendored in gitattributes ([#26](https://github.com/Nixinova/LinguistJS/issues/26)).
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/parse-gitattributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type ParsedGitattributes = Array<{
export default function parseAttributes(content: string, folderRoot: string = '.'): ParsedGitattributes {
const output: ParsedGitattributes = [];

for (const line of content.split('\n')) {
for (const rawLine of content.split('\n')) {
const line = rawLine.replace(/#.*$/, '').trim();
if (!line) continue;

const parts = line.split(/\s+/g);
Expand Down

0 comments on commit 3ddd8dc

Please sign in to comment.