Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix benchsuite issue with newer versions of git (#15069)
This fixes a problem introduced with git 2.48.0 where the benchsuite would fail to run. The problem is that 2.48 changed the behavior so that HEAD would get changed to follow the remote. crates.io-index's default branch is "main". The benchsuite uses git to initialize the bare repo with a HEAD of "refs/heads/master" (the default of `init.defaultBranch`). Older versions of git would leave HEAD untouched, but newer versions update it to "refs/heads/main" after fetching to match the remote. This causes cargo to try to clone a branch called "main" which is empty. The solution here is to just force HEAD to be main, and use that as the branch for our time-travelling snapshot. Tested with git 2.47.0 and 2.48.1. Test is roughly: ``` rm -rf target/tmp/bench ; cargo test -p benchsuite --all-targets -- cargo && cargo test -p benchsuite --all-targets -- cargo` ``` (Run it twice to verify it can do an incremental fetch.)
- Loading branch information