From 255673b983a675e062eb0f3c4ea2017c47e048d1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 7 Oct 2020 20:56:00 +0200 Subject: main(): Open repository even if PWD is a subdirectory Previously, running `git todo` outside the root of the repository would result in this error: error: unable to open repository: could not find repository from '.'; class=Repository (6); code=NotFound (-3) It turns out the `open()` method expects the given path to be the repository root. Use `open_from_env()` instead, which functions more like regular Git commands. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 1a41001..775dfae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,7 +50,7 @@ fn main() { process::exit(exitcode::OK); } - let repo = match Repository::open(".") { + let repo = match Repository::open_from_env() { Ok(r) => r, Err(e) => { eprintln(&format!("unable to open repository: {}", e)); -- cgit v1.2.3