build_helper: handle emails containing square brackets#140675
build_helper: handle emails containing square brackets#140675japaric wants to merge 1 commit intorust-lang:mainfrom
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
Kobzol
left a comment
There was a problem hiding this comment.
Thanks, left one nit, but otherwise looks fine. I wonder if this escaping works on Windows.
| pub git_merge_commit_email: &'a str, | ||
| } | ||
|
|
||
| impl GitConfig<'_> { |
There was a problem hiding this comment.
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. |
|
Thanks for your contribution @japaric from wg-triage. |
|
is this made obsolete by 138cc27 |
|
Ah, you're right, I thought that I saw something like this somewhere before. Yeah, this should work now, hopefully! Thank you for the PR. |
The
gitAPI shells out togit rev-listand was directly passing an email string to the command's--authorflag. 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
bootstrapcrate because it contains the testing infrastructure to create temporary git repositories.fixes #140669