-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disallow child unignoring parent directory ignore #116
Conversation
Perhaps I'm not seeing it clearly enough, but I don't see how this distinguishes between a file that was excluded in the parent which is now being included, and a file that is in a directory that was excluded in the parent which is now being included. The former should still work, if I read the spec correctly. |
You're right. In my testing I thought git was ignoring both categories but it seems I mis-tested. I've adjusted the PR and added new tests. The added test fails on the |
I think you're on the right path here. Since
perhaps this new if statement can also move inside that block? Also I think an explicit test for this would be better than trying to shoehorn into an existing one. The existing one was almost certainly not made with this in mind, and a new test would be best for isolating exactly the behavior we want to test for. |
Makes sense. I've updated the PR. |
Great! Almost there. It looks like the test includes "directories that are ignored can't have files in it be unignored" but does it have "files that are ignored can be unignored"? |
@wraithgar Those are tested in |
This closed #17 I believe. If not we can reopen it. |
The fix in #116 was not quite complete. git does allow unignoring directories as long as its path to the root is unignored. This modifies the check to handle this case. The test case in `nested-ignores.js` was indeed wrong because it interpreted unignoring a specific file `!/h/c/d/hcd` as unignoring the directory `!/h/c/d`. I added new tests that specifically unignore a directory and therefore allow unignoring anything else within it. ## References Related to #116
This solves issues with
npm pack
(this library is used by npm-packlist which implements the command).References
Related to npm/cli#7007