Skip to content

Commit f0db241

Browse files
committed
handle last-commit in Config::download_ci_rustc_commit for CI
Signed-off-by: onur-ozkan <[email protected]>
1 parent 9b8b66e commit f0db241

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bootstrap/src/core/config/config.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::core::config::flags::{Color, Flags, Warnings};
2121
use crate::utils::cache::{Interned, INTERNER};
2222
use crate::utils::channel::{self, GitInfo};
2323
use crate::utils::helpers::{exe, output, t};
24+
use build_helper::ci::CiEnv;
2425
use build_helper::exit;
2526
use build_helper::util::fail;
2627
use semver::Version;
@@ -2418,13 +2419,16 @@ impl Config {
24182419
let compiler = format!("{top_level}/compiler/");
24192420
let library = format!("{top_level}/library/");
24202421

2422+
// If we are running in CI, the current commit will never have artifacts already built.
2423+
let tip_commit = if CiEnv::is_ci() { "HEAD^" } else { "HEAD" };
2424+
24212425
// Look for a version to compare to based on the current commit.
24222426
// Only commits merged by bors will have CI artifacts.
24232427
let merge_base = output(
24242428
self.git()
24252429
.arg("rev-list")
24262430
.arg(format!("--author={}", self.stage0_metadata.config.git_merge_commit_email))
2427-
.args(["-n1", "--first-parent", "HEAD"]),
2431+
.args(["-n1", "--first-parent", tip_commit]),
24282432
);
24292433
let commit = merge_base.trim_end();
24302434
if commit.is_empty() {

0 commit comments

Comments
 (0)