aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2020-10-07 20:56:00 +0200
committerTeddy Wing2020-10-07 20:56:00 +0200
commit255673b983a675e062eb0f3c4ea2017c47e048d1 (patch)
treeaf93d472742c5db70b7f79ab8215e6a2f696807e /src/main.rs
parent651ad535a7890697b44a050e3150656b3782f541 (diff)
downloadgit-todo-255673b983a675e062eb0f3c4ea2017c47e048d1.tar.bz2
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs2
1 files changed, 1 insertions, 1 deletions
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));