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
instead of writing a .gitignore
with /target
-- output a .gitignore
with *
*inside* target/
#11548
Comments
This looks pretty interesting! Thanks for your proposal. There are several things needs to consider. One is backward compatibility. I believe it is rare that a user commits stuff under Cargo supports various kinds of VCS, e.g. Git, Mecurial, Pijul, and Fossil. We don't need to do it all at once, as 99% of Rust projects choose Git. Still, we can perform more researches on how other VCS works. Going further, “which VCS ignore file should be generated” becomes a question. Is it a good practice for Cargo to check VCS information for each run of The idea is cool anyway. Thank you again. |
Writing 4 tiny (single line) files should not be a significant cost compared to any kind of average cargo compile, even hello world. Meson for example generates ones for git and mercurial only, but others wouldn't be difficult, assuming they provide glob support. However, it only generates them once. Cargo could do the same if |
Please keep |
In what case would you need target to be a symlink? |
I keep my build artifacts on a separate partition to keep my main one from croaking when it gets too full. It also makes it easy to keep them out of backups by just ignoring where all build artifacts live. |
Can't the target directory be controlled via a config option or environment variable? Alternatively, a bind mount is also possible. I don't know how the cargo team sees it, but this seems like a fairly niche use case, it feels like the usability improvement would be greater in the general case. Besides, you can still have an additional .gitignore file in the project directory itself, it just wouldn't be there by default (just as target as a symlink isn't there by default, so I think this could be easily added to whatever setup script you may have) |
Can it include variables? Say,
I don't think involving
That doesn't help with projects I contribute to (I've made quite a few PRs removing the trailing slash in projects' |
Problem
currently
cargo init
helpfully writes out a.gitignore
with the following contents:/target
this ~generally means that any rust project now needs to have this
/target
entry in.gitignore
instead of needing this in
.gitignore
, one can create a self-ignoring directory by writing a.gitignore
with the contents*
inside of it. this is (for example) whatvirtualenv
does:this would remove the need for everyone having
/target
in theirgitignore
and instead have it be automatic!Proposed Solution
the proposal is to create a
.gitignore
with*
in thetarget
directory upon creation and phase out the top-level.gitignore
's/target
entryNotes
No response
The text was updated successfully, but these errors were encountered: