If the rustc commit cannot be retrieve, just checkout the repository

This commit is contained in:
Guillaume Gomez 2023-12-20 21:33:21 +01:00
parent 9a8245fed8
commit 87a704a227

View File

@ -503,7 +503,15 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<(), String> {
Some(commit_hash) => commit_hash,
None => return Err("Couldn't retrieve rustc commit hash".to_string()),
};
run_command_with_output_and_env(&[&"git", &"checkout", &rustc_commit], rust_dir, Some(env))?;
if rustc_commit != "unknown" {
run_command_with_output_and_env(
&[&"git", &"checkout", &rustc_commit],
rust_dir,
Some(env),
)?;
} else {
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
}
let cargo = String::from_utf8(
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
)