Skip to content

Commit

Permalink
fix: use more general language in repo-root finding
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed May 10, 2024
1 parent df95c12 commit e86bfd0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions moz-webgpu-cts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn run(cli: Cli) -> ExitCode {
subcommand,
} = cli;

let checkout = match checkout.map(Ok).unwrap_or_else(search_for_moz_central_ckt) {
let checkout = match checkout.map(Ok).unwrap_or_else(search_for_repo_root) {
Ok(ckt_path) => ckt_path,
Err(AlreadyReportedToCommandline) => return ExitCode::FAILURE,
};
Expand Down Expand Up @@ -1499,19 +1499,19 @@ fn read_files_at(
.chain(file_read_iter.into_iter().flatten())
}

/// Search for a `mozilla-central` checkout either via Mercurial or Git, iterating from the CWD to
/// Search for source code repository root either via Mercurial or Git, iterating from the CWD to
/// its parent directories.
///
/// This function reports to `log` automatically, so no meaningful [`Err`] value is returned.
fn search_for_moz_central_ckt() -> Result<PathBuf, AlreadyReportedToCommandline> {
fn search_for_repo_root() -> Result<PathBuf, AlreadyReportedToCommandline> {
use lets_find_up::{find_up_with, FindUpKind, FindUpOptions};

let find_up_opts = || FindUpOptions {
cwd: Path::new("."),
kind: FindUpKind::Dir,
};
let find_up = |repo_tech_name, root_dir_name| {
log::debug!("searching for {repo_tech_name} checkout of `mozilla-central`…");
log::debug!("searching for {repo_tech_name} repository root…");
let err = || {
miette!(
"failed to find a {} repository ({:?}) in {}",
Expand All @@ -1538,13 +1538,13 @@ fn search_for_moz_central_ckt() -> Result<PathBuf, AlreadyReportedToCommandline>
Err(e2) => {
log::warn!("{e:?}");
log::warn!("{e2:?}");
log::error!("failed to find a Gecko repository root");
log::error!("failed to automatically find a repository root");
Err(AlreadyReportedToCommandline)
}
})?;

log::info!(
"detected Gecko repository root at {}",
"detected repository root at {}",
gecko_source_root.display()
);

Expand Down

0 comments on commit e86bfd0

Please sign in to comment.