-
-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Description
Describe the bug
.gitignore files are parsed in a manner inconsistent with their specification.
To Reproduce
Steps to reproduce the behavior:
- Setup a yarn 2 project using Plug'n'Play.
- Create a .gitignore file as recommended by yarn, optionally replacing the
.yarn/*
with.yarn/**
. - Set the
"gitignore"
and"blame"
options to true in .jscpd.json. - Install some unplugged dependencies using yarn.
- PnPify some SDKs using
yarn pnpify --sdks
. - Commit your work to git.
- Run jscpd on the current working directory.
- The
.yarn/sdks/
and.yarn/unplugged/
directories are searched for duplicates despite being gitignored, resulting in a "fatal: no such path" crash fromgit blame
since these directories are not tracked.
Expected behavior
I expected the files and directories within the .yarn/
directory that were not listed in .gitignore with a leading !
to be excluded.
Desktop (please complete the following information):
- OS: Ubuntu
- OS Version 21.04
- NodeJS Version 16.2.0
- jscpd version 3.3.26
Additional context
I have not fully investigated the issue, but I observed that gitignore-to-glob filters hidden files and directories out of the gitignore file, so I recommend simply running git-check-ignore and only supporting this feature when Git is installed. Alternatively, this issue may be resolved by switching to [email protected].
Workaround
Add "./.yarn/**"
to the "ignore"
array in .jscpd.json.
Metadata
Metadata
Assignees
Labels
No labels