Skip to content

Commit 9411af3

Browse files
authored
Merge pull request #320 from lukas-code/missing-nightly
fix getting working commit with missing nightlies
2 parents e61eb10 + 0a8f5dc commit 9411af3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/github.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::{bail, Context};
22
use reqwest::header::{HeaderMap, HeaderValue, InvalidHeaderValue, AUTHORIZATION, USER_AGENT};
3-
use reqwest::{self, blocking::Client, blocking::Response};
3+
use reqwest::{blocking::Client, blocking::Response};
44
use serde::{Deserialize, Serialize};
55

66
use crate::{parse_to_naive_date, Commit, GitDate};

src/main.rs

+18-4
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)