diff --git a/src/github.rs b/src/github.rs index 5f11080..29f600e 100644 --- a/src/github.rs +++ b/src/github.rs @@ -1,6 +1,6 @@ use anyhow::{bail, Context}; use reqwest::header::{HeaderMap, HeaderValue, InvalidHeaderValue, AUTHORIZATION, USER_AGENT}; -use reqwest::{self, blocking::Client, blocking::Response}; +use reqwest::{blocking::Client, blocking::Response}; use serde::{Deserialize, Serialize}; use crate::{parse_to_naive_date, Commit, GitDate}; diff --git a/src/main.rs b/src/main.rs index 8a25dc2..8699039 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,8 +32,8 @@ use crate::github::get_commit; use crate::least_satisfying::{least_satisfying, Satisfies}; use crate::repo_access::{AccessViaGithub, AccessViaLocalGit, RustRepositoryAccessor}; use crate::toolchains::{ - download_progress, parse_to_naive_date, DownloadParams, InstallError, TestOutcome, Toolchain, - ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD, + download_progress, parse_to_naive_date, DownloadError, DownloadParams, InstallError, + TestOutcome, Toolchain, ToolchainSpec, NIGHTLY_SERVER, YYYY_MM_DD, }; #[derive(Debug, Clone, PartialEq)] @@ -603,9 +603,23 @@ impl Config { &nightly_bisection_result.searched[nightly_bisection_result.found]; if let ToolchainSpec::Nightly { date } = nightly_regression.spec { - let previous_date = date.pred_opt().unwrap(); + let mut previous_date = date.pred_opt().unwrap(); + let working_commit = loop { + match Bound::Date(previous_date).sha() { + Ok(sha) => break sha, + Err(err) + if matches!( + err.downcast_ref::(), + Some(DownloadError::NotFound(_)), + ) => + { + eprintln!("missing nightly for {}", previous_date.format(YYYY_MM_DD)); + previous_date = previous_date.pred_opt().unwrap(); + } + Err(err) => return Err(err), + } + }; - let working_commit = Bound::Date(previous_date).sha()?; let bad_commit = Bound::Date(date).sha()?; eprintln!( "looking for regression commit between {} and {}",