According to the gitattributes docs:
"When more than one pattern matches the path, a later line overrides
an earlier line. This overriding is done per attribute."
I had a need to do this recently, and while the attributes are git-lfs
specific, I think the issue may be generic.
Summary: Trying to apply attributes to file extensions everywhere
except in one directory.
.gitattributes:
*.[Pp][Nn][Gg] filter=lfs diff=lfs merge=lfs -text
/.readme-docs/ -filter=lfs -diff=lfs -merge=lfs
Make some data:
echo "asldkjfa;sldkjf;alsdjf" > ./.readme-docs/test.png
git add -A
Result:
"git check-attr -a --cached -- ./readme-docs/test.png" still shows
"filter=lfs diff=lfs merge=lfs" attributes.
Full details:
https://github.com/git-lfs/git-lfs/issues/2120#issuecomment-374432354
Is this me misunderstanding something in the documentation? I would
expect "./.readme-docs/" to match "./.readme-docs/test.png" and
override the earlier "*.[Pp][Nn][Gg]" attributes.
I have found the following overrides to work in lieu of the directory match:
/.readme-docs/* -filter=lfs -diff=lfs -merge=lfs
/.readme-docs/**/* -filter=lfs -diff=lfs -merge=lfs
...but I don't see a justification in the documentation for this
working and the original directory filter not working.
Thanks for any clarification or help you can provide,
- Dakota