about summary refs log tree commit diff
diff options
context:
space:
mode:
authortempdragon <645703113@qq.com>2024-02-14 08:12:10 +0800
committertempdragon <645703113@qq.com>2024-02-14 08:12:10 +0800
commit452ebf5f376971bec12364f56a7bb71125edf1fc (patch)
treedd4935374549546440b5c88c3093ba579f5d92f1
parent6afabceaa67e9d6dcc8b98cec40528f98cb5079b (diff)
downloadrust-452ebf5f376971bec12364f56a7bb71125edf1fc.tar.gz
rust-452ebf5f376971bec12364f56a7bb71125edf1fc.zip
feat(test.rs): Clone only 1 layer in build_system
-rw-r--r--build_system/src/test.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/build_system/src/test.rs b/build_system/src/test.rs
index d7f7a0eb47e..f4e68ae710c 100644
--- a/build_system/src/test.rs
+++ b/build_system/src/test.rs
@@ -499,17 +499,29 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
             &"clone",
             &"https://github.com/rust-lang/rust.git",
             &rust_dir_path,
+            &"--depth",
+            &"1",
         ],
         None,
         Some(env),
     );
     let rust_dir: Option<&Path> = Some(&rust_dir_path);
     run_command(&[&"git", &"checkout", &"--", &"tests/"], rust_dir)?;
-    run_command_with_output_and_env(&[&"git", &"fetch"], rust_dir, Some(env))?;
     let rustc_commit = match rustc_version_info(env.get("RUSTC").map(|s| s.as_str()))?.commit_hash {
         Some(commit_hash) => commit_hash,
         None => return Err("Couldn't retrieve rustc commit hash".to_string()),
     };
+    run_command_with_output_and_env(
+        &[
+            &"git",
+            &"fetch",
+            &"https://github.com/rust-lang/rust.git",
+            &rustc_commit.as_str(),
+            &"--depth=1",
+        ],
+        rust_dir,
+        Some(env),
+    )?;
     if rustc_commit != "unknown" {
         run_command_with_output_and_env(
             &[&"git", &"checkout", &rustc_commit],