build_helper: handle emails containing square brackets by japaric · Pull Request #140675 · rust-lang/rust (original) (raw)

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 #140669