Skip to content

Commit c6d3f65

Browse files
author
Lukas Markeffsky
committed
fix getting working commit with missing nightlies
1 parent e61eb10 commit c6d3f65

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/main.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use crate::github::get_commit;
3232
use crate::least_satisfying::{least_satisfying, Satisfies};
3333
use crate::repo_access::{AccessViaGithub, AccessViaLocalGit, RustRepositoryAccessor};
3434
use crate::toolchains::{
35-
download_progress, parse_to_naive_date, DownloadParams, InstallError, TestOutcome, Toolchain,
36-
ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD,
35+
download_progress, parse_to_naive_date, DownloadError, DownloadParams, InstallError,
36+
TestOutcome, Toolchain, ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD,
3737
};
3838

3939
#[derive(Debug, Clone, PartialEq)]
@@ -603,9 +603,23 @@ impl Config {
603603
&nightly_bisection_result.searched[nightly_bisection_result.found];
604604

605605
if let ToolchainSpec::Nightly { date } = nightly_regression.spec {
606-
let previous_date = date.pred_opt().unwrap();
606+
let mut previous_date = date.pred_opt().unwrap();
607+
let working_commit = loop {
608+
match Bound::Date(previous_date).sha() {
609+
Ok(sha) => break sha,
610+
Err(err)
611+
if matches!(
612+
err.downcast_ref::<DownloadError>(),
613+
Some(DownloadError::NotFound(_)),
614+
) =>
615+
{
616+
eprintln!("missing nightly for {}", previous_date.format(YYYY_MM_DD));
617+
previous_date = previous_date.pred_opt().unwrap();
618+
}
619+
Err(err) => return Err(err),
620+
}
621+
};
607622

608-
let working_commit = Bound::Date(previous_date).sha()?;
609623
let bad_commit = Bound::Date(date).sha()?;
610624
eprintln!(
611625
"looking for regression commit between {} and {}",

0 commit comments

Comments
 (0)