summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-11-11 15:14:28 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-11-11 15:14:28 +0100
commite3d4b9ce040bea5e684de131c9c9ce54d2fe30ee (patch)
treef16525d9827b7928c10700ef679389b108dc4383 /src
parent492be316c4dde88e3b9ae08810074a2d0c0e5c27 (diff)
Simplify error message if butido is not executed from the package repository
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 6 insertions, 4 deletions
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!"))?;