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
proposal: reconsider allowing emacs and vim patterns in gitignore files #23800
Comments
There's myriad editors that drop working files in all sorts of places. I'm much more in favour of people who use editor X having to do a one-off configuration to stop git trying to track editor X's temp files. |
Note also that there are oodles of git repositories floating around, not just ones for the Go project. Even if all of Go's git repositories had a suitable |
There's also a very heavy concentration of users in just a few editors who put stuff in a few standard places--and that's what this proposal is about. |
Yes. What @josharian said. This is about low hanging fruit, not solving every possible junk file. |
One benefit of the current policy is that it makes it easy to reject CLs (and discourage them from being created) that try to add "SomeObscureAndQuestionableFile" to If this proposal is accepted, will the policy be modified to match the new .gitignore contents? Something like this? -# Add no patterns to .gitignore except for files generated by the build.
+# Add no patterns to .gitignore except for files generated by the build,
+# common Emacs and vim files. I'm asking this because I think it'd be helpful to think through what it'll be like if that's the future we go with. |
I prefer |
There are (at least) three ways of ignoring files in git:
In summary, developers should configure their machines ( I am against the proposal. |
I'll try once more to make this case for this proposal. I agreed, adding these to .gitignore is not the Right Way. It is nevertheless a reasonable, practical thing to do. If we were a small stable team, we could put in a bit of effort to get all team members on the same page. Instead, we're a large, sprawling open source project. I'd rather spend my limited educational and review bandwidth on things other than git config. And even folks who do things the Right Way (including me) sometimes encounter little bumps. Maybe I briefly switch editors to avoid my gofmt-on-save hooks, or I hand my keyboard to a colleague who fires up emacs, or I decide to try out Atom for a day. We write a lot of code to prevent and fix other mistakes: pre-submit hooks, git-codereview, maintner, gerritbot, etc. That code generates bugs and feature ideas, requires maintenance, etc. This proposal is exactly the same category of fix–preventing simple, human mistakes–but with the added advantage of being extremely easy to write and maintain. As to the slippery slope argument (of which @shurcooL's question is a variant), I have two responses. First, as Rob likes to say, the Go project is pretty good at finding traction when it is important. And second, for all the reasons listed above, I don't really think it'd be that bad if .gitignore grew organically in response to mistakes that people make, the same way git-codereview has. And since we all have bigger fish to fry, I'll leave it here. |
I'm OK with adding things to .gitignore if the policy of what is OK is clear. It's clear now: only things created by the build. This issue has hinted at a new policy but it's peculiar (add emacs and vim temp files - why only them? The modern world is moving away from these tools) and not well justified as the strict policy. Actually by "I'm OK" I mean I'll go along with it if it makes sense and limits churn. I would prefer we left the policy as is, but don't want to be the lone holdout. Define the policy. For an example of what a clear policy can do, look at how cmd/vet/README has formed the discussion about what goes into vet, with excellent results. The .gitignore story is less important but the lesson still holds. |
.gitignore is good but doesn't have teeth. |
Lord only knows what we'll need to do when we update to HEAD. golang#23800 Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
We seem to have a policy against adding common Emacs and vim gitignore lines.
I propose we allow them.
See recent CL where @ianlancetaylor tried to add them, to @robpike's objection:
https://go-review.googlesource.com/c/tools/+/93415
Then @ianlancetaylor reverted it, but accidentally added emacs junk files to the CL (in PS1), kinda proving that they would've been helpful in preventing garbage being added to the repo:
https://go-review.googlesource.com/c/tools/+/93437
Regarding per-user gitignore files, I wrote in the above CL comments:
See related bug #21458 that's about removing stuff from the "go" repo's
.gitignore
. But notably, the "go" repo's.gitignore
contains the Emacs/etc lines.Our current policy seems to only be about not adding them to the other repos, which is inconsistent.
I'd prefer we be consistent and ignore
*~
, etc in all repos.The text was updated successfully, but these errors were encountered: