Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch origin HEAD on checkout #1684

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions collector/src/compile/execute/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,23 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
.status()
.context("git fetch origin")?;

if !status.success() && matches!(artifact, ArtifactId::Tag(_)) {
if !status.success() {
log::warn!(
"git fetch origin {} failed - trying default branch",
"git fetch origin {} failed, this will likely break the build",
artifact
);
status = Command::new("git")
.current_dir("rust")
.arg("fetch")
.arg("origin")
.arg("HEAD")
.status()
.context("git fetch origin HEAD")?;
}

// Regardless, we fetch the default branch. Upstream Rust started using `git merge-base`
// recently, which (reasonably) finds the wrong base if we think e.g. origin/master
// diverged thousands of commits ago.
status = Command::new("git")
.current_dir("rust")
.arg("fetch")
.arg("origin")
.arg("HEAD")
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
.status()
.context("git fetch origin HEAD")?;
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved
assert!(status.success(), "git fetch successful");
} else {
let status = Command::new("git")
Expand Down