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

Ignore .git, .svn and .hg directories #4906

Merged
merged 2 commits into from Jul 29, 2018
Merged

Ignore .git, .svn and .hg directories #4906

merged 2 commits into from Jul 29, 2018

Conversation

azz
Copy link
Member

@azz azz commented Jul 29, 2018

Don't really see a compelling case for a CLI argument for this.

Fixes #4895

Note: Can't actually add a .git test because git ignores the files 😉

@@ -403,6 +403,7 @@ function eachFilename(context, patterns, callback) {
if (ignoreNodeModules) {
patterns = patterns.concat(["!**/node_modules/**", "!./node_modules/**"]);
}
patterns = patterns.concat(["!**/.{git,svn,hg}/**", "!./.{git,svn,hg}/**"]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the !./.{git,svn,hg}/** part is unnecessary, and so does !./node_modules/**.

$ tree test
test
├── dir
│   ├── node_modules
│   │   └── x.js
│   └── x.js
├── node_modules
│   └── x.js
└── x.js

$ node -e 'console.log(
  require("globby").sync(
    ["**/*.js", "!**/node_modules/**"],
    { cwd: "test" }
  )
)'
[ 'dir/x.js', 'x.js' ]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try re-running that with ./**/*.js as the glob.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, didn't know that. Can you add a comment for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@azz azz merged commit a938076 into prettier:master Jul 29, 2018
@azz azz deleted the git-exclude branch July 29, 2018 14:08
@ikatyang ikatyang added this to the 1.14.1 milestone Aug 2, 2018
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Oct 31, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants