Skip to content

Commit 87a704a

Browse files
If the rustc commit cannot be retrieve, just checkout the repository
1 parent 9a8245f commit 87a704a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

build_system/src/test.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,15 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<(), String> {
503503
Some(commit_hash) => commit_hash,
504504
None => return Err("Couldn't retrieve rustc commit hash".to_string()),
505505
};
506-
run_command_with_output_and_env(&[&"git", &"checkout", &rustc_commit], rust_dir, Some(env))?;
506+
if rustc_commit != "unknown" {
507+
run_command_with_output_and_env(
508+
&[&"git", &"checkout", &rustc_commit],
509+
rust_dir,
510+
Some(env),
511+
)?;
512+
} else {
513+
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
514+
}
507515
let cargo = String::from_utf8(
508516
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
509517
)

0 commit comments

Comments
 (0)