-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo new does not follow "includeIf" in .gitconfig #8882
Comments
My understanding is that this behaviour is correct - the However, in terms of practicality, it's not ideal. If we're lucky changing cargo/src/cargo/ops/cargo_new.rs Line 856 in 9051345
to get the config in the new directory would fix this. |
Fair enough.
Yes, this seems correct. It is exemplified by the fact that How do you think changing
The second option seems preferable to me (because no implicit global state in form of the current working directory would need to be changed). However, it would require the Or is there another way that I don't see? |
Yeah, passing the parameters down the call stack would be the correct method. Changing the current directory is very fragile. |
…lexcrichton Start searching git config at new path This lets `cargo new` follow `includeIf` blocks inside .gitignore. Fixes #8882 I am not sure if removing the `__CARGO_TEST_ROOT` environment variable has any bad side effects. My quick grep of the repository didn't highlight anything in particular.
This is a trivial bug: The name and/or email address of the user may not be set correctly by
cargo new
.Problem
cargo new
sets the user name and email in theCargo.toml
file based on the values configured for Git. Since version 2.13,.gitconfig
can include other configuration files based on the prefix of the repository. I use this to set separate email addresses for private and work projects based on where a repository is located in my file system. See this Stackoverflow answer for details.Unfortunately, Cargo (version
1.48.0 (65cbdd2dc 2020-10-14)
) seems to ignore these include directives.Steps
includeIf
directive to the global.gitconfig
:cargo new
in a directory with the prefix of theincludeIf
:Expected outcome:
The generated file
~/test/example-project/Cargo.toml
uses the user details from~/test/.gitconfig
:Actual outcome:
The
Cargo.toml
file does not include the set user details:Possible Solution(s)
Updating whatever is parsing the
.gitconfig
files might solve the problem.Notes
Output of
cargo version
:The text was updated successfully, but these errors were encountered: