Skip to content

Commit c4ae1cd

Browse files
committed
better clone technique and unsupported OS messages
1 parent 6ef6987 commit c4ae1cd

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

dev-tools/downloader/src/lib.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,12 @@ impl<'a> Downloader<'a> {
257257
let temp_dir = tempfile::tempdir()?;
258258
let temp_path = Utf8PathBuf::try_from(temp_dir.path().to_path_buf())?;
259259

260-
// Shallow clone the repository
260+
// Clone and checkout the specific commit
261261
info!(self.log, "Cloning {repo_url}");
262262
let mut clone_cmd = Command::new("git");
263263
clone_cmd
264264
.arg("clone")
265-
.arg("--depth")
266-
.arg("1")
267-
.arg("--branch")
268-
.arg(commit)
265+
.arg("--filter=blob:none")
269266
.arg(repo_url)
270267
.arg(&temp_path);
271268

@@ -275,6 +272,17 @@ impl<'a> Downloader<'a> {
275272
bail!("Failed to clone {repo_url}: {stderr}");
276273
}
277274

275+
// Checkout the specific commit
276+
info!(self.log, "Checking out commit {commit}");
277+
let mut checkout_cmd = Command::new("git");
278+
checkout_cmd.arg("checkout").arg(commit).current_dir(&temp_path);
279+
280+
let checkout_output = checkout_cmd.output().await?;
281+
if !checkout_output.status.success() {
282+
let stderr = String::from_utf8_lossy(&checkout_output.stderr);
283+
bail!("Failed to checkout {commit}: {stderr}");
284+
}
285+
278286
// Build each binary
279287
tokio::fs::create_dir_all(&cache_dir).await?;
280288
let mut result_paths = Vec::new();

tools/install_builder_prerequisites.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function install_packages {
199199
)
200200
confirm "Install (or update) [${packages[*]}]?" && brew install "${packages[@]}"
201201
else
202-
echo "Unsupported OS: ${HOST_OS}"
202+
echo "Skipping builder prereqs for unsupported OS: ${HOST_OS}"
203203
exit 1
204204
fi
205205
}

tools/install_runner_prerequisites.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function install_packages {
153153
confirm "Install (or update) [${packages[*]}]?" && $maybe_sudo apt-get install "${packages[@]}"
154154
fi
155155
else
156-
echo "Unsupported OS: ${HOST_OS}"
156+
echo "Skipping runner prereqs for unsupported OS: ${HOST_OS}"
157157
exit 1
158158
fi
159159
}

0 commit comments

Comments
 (0)