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

meta: whitelist dotfiles in .gitignore #8016

Closed

Conversation

claudiorodriguez
Copy link
Contributor

Checklist
  • commit message follows commit guidelines
Affected core subsystem(s)

meta

Description of change

Instead of excluding IDE-specific dotfiles, exclude all and then whitelist those the project needs to track.

Fixes: #8012

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Aug 8, 2016
@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

There are a lot for dot-prefixed files in deeper levels.

E.g. in test directory:

./test/addons/.gitignore
./test/.eslintrc
./test/fixtures/.empty-repl-history-file
./test/fixtures/empty/.gitkeep
./test/fixtures/.node_repl_history

@silverwind
Copy link
Contributor

silverwind commented Aug 8, 2016

There are a lot for dot-prefixed files in deeper levels.

IIRC, filenames without / are recursive by default.

@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

@silverwind Exactly. And by blacklisting .* and not whitelisting ./test/fixtures/.empty-repl-history-file by any rule, it gets blacklisted.

@silverwind
Copy link
Contributor

silverwind commented Aug 8, 2016

It does seem to work, regardless:

$ apply-pr 8016
$ mkdir abc
$ touch abc/.eslintrc
$ touch abc/.dontadd
$ git add --all
$ git status
    new file:   abc/.eslintrc

LGTM once the missing file names are added.

@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

@silverwind It works only because those files are either already present in git or present in the whitelist.

Try:

$ git rm ./test/fixtures/.empty-repl-history-file
rm 'test/fixtures/.empty-repl-history-file'
$ touch ./test/fixtures/.empty-repl-history-file
$ git add ./test/fixtures/.empty-repl-history-file
The following paths are ignored by one of your .gitignore files:
test/fixtures/.empty-repl-history-file
Use -f if you really want to add them.

This PR should whitelist all the dot-prefixed-files that we already have in git, not just the top-level ones.

@silverwind
Copy link
Contributor

silverwind commented Aug 8, 2016

Yes, I agree that's needed. Searching dotfiles in the tree, there might be a few more we ought to include. Or better yet, exclude deps and tools from exclusion.

$ find . -name ".*" | xargs basename | sort | uniq

(partially cleaned up)

.babelrc
.bin
.buildstamp
.clang-format
.deps
.dir-locals.el
.docbuildstamp
.dockerignore
.editorconfig
.empty-repl-history-file
.eslintignore
.eslintrc
.git
.gitattributes
.github
.gitignore
.gitkeep
.gitmodules
.ignore
.jscs.json
.jshintrc
.keep
.lint
.lintignore
.mailmap
.node_repl_history
.npmignore
.remarkrc
.rnd
.tern-port
.tern-project
.testignore
.travis.yml
.ycm_extra_conf.py
.zuul.yml

@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

But I don't have .DS_Store (or .dontadd, or .buildstamp, or .docbuildstamp).

Also, I believe that we don't need at least part of those.

@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

Btw, perhaps we should just whitelist all dot-prefixed files in the deps dir and use a blacklist if appropriate?

@silverwind
Copy link
Contributor

Yeah, those were from my local folder. I cleaned up a few in above list. I think most of the useless files there come from deps/npm. I guess we should go through them on a per-case basis if they are really necessary. I'd wager 90% are not.

@silverwind
Copy link
Contributor

I think this should be a more or less complete list of "good" files:

.editorconfig
.eslintignore
.eslintrc
.git
.gitattributes
.github
.gitignore
.gitkeep
.mailmap
.remarkrc

And a list of directories to keep dotfiles from:

deps
test/fixtures
tools/eslint
tools/doc/node_modules

@ChALkeR
Copy link
Member

ChALkeR commented Aug 8, 2016

.git

Nope =)

@imyller
Copy link
Member

imyller commented Aug 8, 2016

👍 for this effort!

One thing to consider is that not all IDEs use dotfiles for their files.

For example Netbeans (and it's commercial variants, I'd assume) create nbproject folder.

@claudiorodriguez
Copy link
Contributor Author

@silverwind just updated the file with those, can you take another look?

@ChALkeR
Copy link
Member

ChALkeR commented Aug 9, 2016

git blame on the lines being deleted:

86eab1f (Ryan Dahl 2009-04-16 13:20:22 +0200 6) .waf*
86eab1f (Ryan Dahl 2009-04-16 13:20:22 +0200 8) .lock-wscript
ff456b3 (Ryan Dahl 2010-10-13 16:20:24 -0700 18) .benchmark_reports
3216f08 (Bert Belder 2010-11-25 01:57:15 +0100 19) /.project
af92315 (Ryan Dahl 2011-03-18 09:14:15 -0700 20) /.cproject
61886fa (Mike Kaufman 2016-04-13 14:38:19 -0700 45) .vs/
1e1bbe5 (Josh Gavant 2016-08-03 14:35:48 -0700 46) .vscode/
c6843f4 (Bert Belder 2012-07-07 23:19:12 +0200 45) .svn/

We should check that nothing of those was targeted towards the files that are being whitelisted now (i.e. deps/, test/, tools/).

@claudiorodriguez
Copy link
Contributor Author

claudiorodriguez commented Aug 9, 2016

@ChALkeR Except for /.project and /.cproject (the ignore being at root level), I could leave the others in, just in case.

EDIT: I also put the dotfile whitelist at the top of the file so all the other *.<something> ignores apply to the folders

Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Fixes: nodejs#8012
@ChALkeR
Copy link
Member

ChALkeR commented Aug 9, 2016

@claudiorodriguez I don't think we should leave those in, we should rather check where those came from.

E.g. .benchmark_reports is definitely not needed, it was being created by the benchmarks at some point in the past, but that doesn't seem to be the case now.

@claudiorodriguez
Copy link
Contributor Author

@ChALkeR fair enough.
@ry @mike-kaufman @joshgav @piscisaureus @nodejs/collaborators anyone able to weigh in?

@mike-kaufman
Copy link

Line I added was to ignore .vs/ directory. Looks like this will continue with proposed changes, so LGTM.

@jasnell
Copy link
Member

jasnell commented Aug 10, 2016

I haven't tested this out locally just yet so I won't sign off on it but nothing stands out as problematic in the patch.

@joshgav
Copy link
Contributor

joshgav commented Aug 10, 2016

Replacing .vscode/ as proposed LGTM. Can't say I'm overall in favor of this change though as I don't have a problem with the existing arrangement.

@imyller
Copy link
Member

imyller commented Aug 15, 2016

Any progress on this?

@claudiorodriguez
Copy link
Contributor Author

@ChALkeR do you think it would make sense to leave them in for now and remove them in future PRs?

@jasnell were you able to test locally?

@imyller
Copy link
Member

imyller commented Sep 24, 2016

Can we get this PR moving forward? Any objections to landing the proposed changes?

@jasnell
Copy link
Member

jasnell commented Sep 26, 2016

No objections. @nodejs/ctc any objections on this?

@rvagg rvagg force-pushed the master branch 2 times, most recently from c133999 to 83c7a88 Compare October 18, 2016 17:02
@sam-github
Copy link
Contributor

I'm rebuilding to confirm, but AFAICT, after doing a make -j8 test, as required for PRs, there are 600+ files listed as ??/unknown. I'm rebuilding again from scratch after a git clean to confirm, but am I doing something wrong? How did it get like this?

Granted, this happened before the change, but if we're improving the .gitignore file, why not make it work?

As for the change to whitelisting, I'm +0 on it. It supports people who haven't added their editor's temp files to their ~/.gitignore (why?) a bit better, and hopefully won't confuse people when adding new files. Lets give it a try, and see if it makes things better.

@sam-github
Copy link
Contributor

OK, I take #8016 (comment) it back, I can't repro with a completely clean build, I've no idea what happened.

@Trott Trott mentioned this pull request Dec 2, 2016
2 tasks
@Trott
Copy link
Member

Trott commented Dec 2, 2016

Bump. This seemed poised to land, but never did. I don't feel strongly about this one either way, but I guess if it means we stop having to evaluate (and typically reject) PRs adding this or that dot-file every now and then, I'm mildly in favor.

@@ -1,3 +1,19 @@
# Whitelist dotfiles
.*
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to use /.* ? I think that way we wouldn't have to whitelist subdirectories below.

Copy link
Member

Choose a reason for hiding this comment

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

There are meta files from various file managers (e.g. Finder in macOS), IDEs, version control systems, backup systems that can/will create dotfiles in subdirectories.

I think it's easier to whitelist what the Node.js project knows it needs than to react case-by-case to every external product out there.

@claudiorodriguez
Copy link
Contributor Author

I think there's no reason not to land it, I'll land in 24 hours if no one objects.

@silverwind
Copy link
Contributor

@claudiorodriguez can you take care of #8016 (comment)? LGTM otherwise.

@claudiorodriguez
Copy link
Contributor Author

@silverwind I didn't remove those since they could still appear in test/fixtures, tools/eslint, or tools/doc/node_modules, and they wouldn't get ignored.

@silverwind
Copy link
Contributor

they wouldn't get ignored.

Wouldn't the .* pick those up?

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

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

Applied without issue (other than a merge conflict solves by 3-way merge), tests pass, all files seem to be there, git status is clean, anything else holding this up?

@Fishrock123
Copy link
Contributor

Fishrock123 commented Dec 5, 2016

Thanks, landed in 15cc7c0.

And well, if anything explodes I guess I'm biting the bullet ¯\_(ツ)_/¯

@Fishrock123 Fishrock123 closed this Dec 5, 2016
Fishrock123 pushed a commit that referenced this pull request Dec 5, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
addaleax pushed a commit that referenced this pull request Dec 5, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
@Fishrock123 Fishrock123 mentioned this pull request Dec 5, 2016
2 tasks
jmdarling pushed a commit to jmdarling/node that referenced this pull request Dec 8, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: nodejs#8010
Refs: nodejs#9111
Refs: nodejs#10052

Fixes: nodejs#8012
PR-URL: nodejs#8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
MylesBorins pushed a commit that referenced this pull request Dec 20, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
MylesBorins pushed a commit that referenced this pull request Dec 20, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
Instead of excluding IDE-specific dotfiles, exclude all and
then whitelist those the project needs to track.

Refs: #8010
Refs: #9111
Refs: #10052

Fixes: #8012
PR-URL: #8016

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
This was referenced Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Whitelist dotfiles instead of blacklisting?