-
Notifications
You must be signed in to change notification settings - Fork 13.4k
build_helper: handle emails containing square brackets #140675
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
base: master
Are you sure you want to change the base?
build_helper: handle emails containing square brackets #140675
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
This comment has been minimized.
This comment has been minimized.
r? @Kobzol |
@rustbot author |
The `git` API shells out to `git rev-list` and was directly passing an email string to the command's `--author` flag. That flag interprets its arguments as a regular expression, meaning that characters like square brackets (`[]`) in the email string made the command fail to find a commit matching the author e-mail This commit escapes the email string prior to passing it to `git rev-list`. The change is tested in the `bootstrap` crate because it contains the testing infrastructure to create temporary git repositories. fixes rust-lang#140669
b2ae2d2
to
7753ce7
Compare
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.
Thanks, left one nit, but otherwise looks fine. I wonder if this escaping works on Windows.
@@ -9,6 +9,16 @@ pub struct GitConfig<'a> { | |||
pub git_merge_commit_email: &'a str, | |||
} | |||
|
|||
impl GitConfig<'_> { |
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.
Nit: could you move this to a free function, such as cli_escape_author_email
? To make it clear from the name what it does.
☔ The latest upstream changes (presumably #119899) made this pull request unmergeable. Please resolve the merge conflicts. |
The
git
API shells out togit rev-list
and was directly passing an email string to the command's--author
flag. That flag interprets its arguments as a regular expression, meaning that characters like square brackets ([]
) in the email string made the command fail to find a commit matching the author e-mailThis commit escapes the email string prior to passing it to
git rev-list
.The change is tested in the
bootstrap
crate because it contains the testing infrastructure to create temporary git repositories.fixes #140669