Skip to content
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

Don't pass options.ignore to isGitIgnored #223

Merged
merged 1 commit into from Jan 20, 2022

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jan 20, 2022

ignore option in isGitIgnored() mean to ignore .gitignore files, but when running globby(), ignore mean to ignore matched files.

For example:

globbySync('**/*', {gitignore: true, ignore: ['.gitignore']})

This mean to glob all files that's not gitignored, but except .gitignore file, not mean don't read the .gitignore file.

Before:

> globbySync('**/*', {gitignore: true, ignore: ['.gitignore']}).filter(file => file.startsWith('node_modules')).length
11662

After:

> globbySync('**/*', {gitignore: true, ignore: ['.gitignore']}).filter(file => file.startsWith('node_modules')).length
0

This is a little hard to test, I didn't add.

@sindresorhus sindresorhus merged commit f816156 into sindresorhus:main Jan 20, 2022
@fisker fisker deleted the git-ignore-ignore branch January 20, 2022 08:56
@fisker
Copy link
Collaborator Author

fisker commented Jan 20, 2022

@sindresorhus After second thought, this ignore option for isGitIgnored doesn't make sense to me either, why someone want to skip reading a specific .gitignore file and let the result be true?

Do you think we should remove it?

@sindresorhus
Copy link
Owner

No idea. It was added a long time ago. I do agree with your reasoning though.

@fisker
Copy link
Collaborator Author

fisker commented Jan 20, 2022

It was added in #48, I think it's added for xo, maybe mean to check file is ignored by ignore option, but it never works that way.

@sindresorhus
Copy link
Owner

Yeah, let's remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants