-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add temporary vim files to .gitignore #4097
Conversation
The first thing I do when creating a new project is editing the .gitignore to ignore temporary vim files. This patch would make git ignore `*.swp` and `*.swo` directly after cargo new, similar to `*.rs.bk`.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
It's probably better for you to include these in a global ignore file, for which |
@@ -384,7 +384,7 @@ fn mk(config: &Config, opts: &MkOptions) -> CargoResult<()> { | |||
let path = opts.path; | |||
let name = opts.name; | |||
let cfg = global_config(config)?; | |||
let ignore = ["target/\n", "**/*.rs.bk\n", | |||
let ignore = ["target/\n", "**/*.rs.bk\n", "*.sw[op]\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also *-swp
files be added? that would look like *[.-]sw[op]
... I think?. This would be useful for me, as Kate generates .filename.kate-swp
files
After reading through some of those, it appears that Unless somebody thinks this might be useful, I'd close this PR. |
I agree with @alexcrichton, these kind of ignores are per-user, not per-project. We'd also be opening the door to adding every kind of temp file a user could create, which would mean everyones' gitignores would be full of files they mostly don't create. |
Yeah, ideally this should be handled by the global gitignore: https://help.github.com/articles/ignoring-files/#create-a-global-gitignore. @Mark-Simulacrum, plain That said, I also believe this is the case where practicality beats purity, and I would be glad to add editor-specific rules to the But adding it to the |
The practical side of this sort of echos with me at this point. We receive so many bug reports related to gitignore it seems that we need to do something. We could maybe add a comment to the file (pointing to the github global gitignore article) or something like that? I'm just thinking that the constant stream of bug reports about this warrants something at least. |
I think a couple possibilities are available to us (perhaps in some combination):
Of these, I think the first and last are my preferences. |
The majority of the linked bug reports are ".gitignore should contain /target and not target", and actually asks us to ignore less, not more. Now that we have workspaces, I think we should ignore only |
The second majority is "let's ignore backup files created by rustfmt", and the ideal solution here would be for |
@matklad hm yeah that's an excellent point! Sounds like a good idea to me. Note that |
Hmm, I guess I'm actually ready to do #873, but I think it would need a warning cycle, so maybe 6-8 weeks? |
Ok I'm going to close this as it sounds like others are in general agreement for now, but thanks regardless for the PR @kpcyrd |
The first thing I do when creating a new project is editing the .gitignore to ignore temporary vim files. This patch would make git ignore
*.swp
and*.swo
directly after cargo new, similar to*.rs.bk
.