Add support for linguist- marks in .gitattributes (adresses #386)
#1292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed tokei does not support the
linguist-vendorred,linguist-documenttaion, andlinguist-generatedmarks you can put in your.gitattributeswhile working on a project of mine, and then found that the issue for this was listed as open and help-wanted (#386), (even a few years later). With this pull request, I attempted to implement this linguist support in the way outlined in the original issue.I haven't programmed in Rust in a while, so I am a bit... rusty (pun absolutely intended.) I hope I did everything properly! ^.^
In this pull request I am:
gix-attributesdependency for.gitattributesparsing, as specified in the original issue.linguist-vendorred,linguist-documenttaion, andlinguist-generatedin.gitattributesto-ignore using overrides.--no-ignore-linguistand its documentation, which disables the functionality I added.EDIT: Coming back a day later, I realize there are some complications that I missed: If you pass multiple directories to tokei, the expected behavior is that each of these directories has its own ignore files that apply locally to the files in those directories, which is indeed how the
.gitignoreis implemented in the ignore crate. However, with how I implemented gitattributes, any found rule in a gitattribute file applies globally to the entire run, even to separately passed directories. I am expecting there to be a decent fix for this, but I'll wait for your comment before putting more time into this PR.(It also appears I flipped the
ignore parentflag.)