From e3d4b9ce040bea5e684de131c9c9ce54d2fe30ee Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 11 Nov 2021 15:14:28 +0100 Subject: Simplify error message if butido is not executed from the package repository Signed-off-by: Matthias Beyer --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 5b0ddba..c0ee15a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,11 +102,13 @@ async fn main() -> Result<()> { let repo = git2::Repository::discover(PathBuf::from(".")) .map_err(|e| match e.code() { - git2::ErrorCode::NotFound => anyhow!("Failed to load the git repository from ./."), + git2::ErrorCode::NotFound => { + eprintln!("Butido must be executed within the package repository"); + std::process::exit(1) + }, _ => Error::from(e), - }) - .context("Loading the git repository") - .context("Butido must be executed within the package repository")?; + })?; + let repo_path = repo .workdir() .ok_or_else(|| anyhow!("Not a repository with working directory. Cannot do my job!"))?; -- cgit v1.2.3