-
Notifications
You must be signed in to change notification settings - Fork 2.7k
An author by another name #2696
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
An author by another name #2696
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Thanks! Maybe this functionality could be refactored a bit as well? (e.g. get an env var from a list of possible keys). Also, could you add a test for one of the |
0f9207c
to
ab22961
Compare
Moved to a function and added test for name and email. |
src/cargo/ops/cargo_new.rs
Outdated
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.
&Vec<T>
is typically more idiomatically written as &[T]
in this case (you can avoid the vec!
as well)
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.
Could you add a space after this >
as well?
ab22961
to
91e4065
Compare
Dearest Reviewer This is to support environment variables for name and email more like git. This closes rust-lang#1213 . I did look in to using libgit2 but I did not see a clear way to get the author ident. This just moves from or_else chaining to map_filter with env checks and getting the nth(0) result. The docs I found https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#Committing do not really indicate an order of preference to the variables. I am more then happy to rearrange the arrays in anyway. Thanks for reviewing, Becker
Thanks for the comments. They are all addressed. I also was trying to figure out how to write the array signature. Thanks for that! Becker |
…xcrichton An author by another name Dearest Reviewer This is to support environment variables for name and email more like git. This closes #1213 . I did look in to using libgit2 but I did not see a clear way to get the author ident. This just moves from or_else chaining to map_filter with env checks and getting the nth(0) result. The docs I found https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#Committing do not really indicate an order of preference to the variables. I am more then happy to rearrange the arrays in anyway. I also did not add in a new test for the positive case because the test for the current variables cover that path. Thanks for reviewing, Becker
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Thanks for working on this! @sbeckeriv wrote:
"man git-commit-tree" provides the full precedence:
I don't think the last fallback (to the username, mailname, and FQDN) makes sense anymore. So the git precedence for name is Adding a name fallback to the generic So, I'd suggest the following: Name: Email: In both cases, the presence of the config item in the middle of the list makes it necessary to split the array, or introduce an enum, or go back to |
Dearest Reviewer, PR rust-lang#2696 added some new checks for environment variables for author and email. After the pull request was merged a comment was left about gits ordering for looking at the variables. This pull request closes rust-lang#2705 by reordering the look up and also addeds CARGO_NAME and CARGO_EMAIL to the top of the order. Thanks Becker
Correct author order Dearest Reviewer, PR #2696 added some new checks for environment variables for author and email. After the pull request was merged a comment was left about gits ordering for looking at the variables. This pull request closes #2705 by reordering the look up and also addeds CARGO_NAME and CARGO_EMAIL to the top of the order. Thanks Becker
Dearest Reviewer
This is to support environment variables for name and email more like
git. This closes #1213 . I did look in to using libgit2 but I did not
see a clear way to get the author ident. This just moves from or_else
chaining to map_filter with env checks and getting the nth(0) result.
The docs I found
https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#Committing
do not really indicate an order of preference to the variables. I am
more then happy to rearrange the arrays in anyway.
I also did not add in a new test for the positive case because the
test for the current variables cover that path.
Thanks for reviewing,
Becker