-
Notifications
You must be signed in to change notification settings - Fork 2.6k
cargo-new ignores $GIT_TEMPLATE_DIR #5420
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
Comments
I think this is similar to #1295 where it was found that libgit2 doesn't read this env var |
You're absolutely right, that's exactly the issue I'm facing here. I'm sorry I haven't looked closely enough. So libgit2/libgit2#2910 (comment) has been closed, saying that "In general, libgit2 does not take environment variables into account", which is really weird because it breaks mental models and personal configuration. I can see only three ways to deal with this:
Oh well. :/ |
Oh I'd be fine in the meantime to change the default behavior of git2-rs, it makes sense to me at least to follow what |
As I mentioned over there, no, we likely will not. This is not a bug. Our philosophy is that we are a simple library and there's little way to predict what our users want to do with it. But I'm not sure why this is a problem; libgit2's defaults are only libgit2's defaults. If you want this behavior in cargo then it should be easy to enable. We would be happy to accept patches that make this experience better and simpler for you, but as mentioned above and in the libgit2 thread - this needs to be explicitly opt in. Please let me know if I can help. 😀 |
I think the next actionable step here is to file this issue against git-rs. |
👍 libgit2 has added some help here - you can now |
Opened an issue in git2-rs: rust-lang/git2-rs#398 |
cargo new
also initializes git. Awesome! Git is configurable through environment variables. Awesome! So why does git, when invoked by cargo, suddenly stop listening to its environment?Steps to reproduce / I tried this:
Expected behavior / I expected to see this happen:
Absence of files/dirs
.git/description
,.git/hooks/
, and.git/info/
.Or more generally: I expected the absence of the files usually found in
/usr/share/git-core/templates
Actual behavior / Instead, this happened:
It seems like all files from
/usr/share/git-core/templates
were copied.My best guess: Either cargo crafts its own "clean" environment (why should it?), or cargo's emulation of git is incomplete.
For reference: A simple
git init
works as I desire, i.e., it obeysGIT_TEMPLATE_DIR
. So at least I'm sure I didn't have a brainfart there.The text was updated successfully, but these errors were encountered: