diff --git a/README.md b/README.md index 410f163d..b02bc0fc 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ gitui * [x] inspect diffs * [x] commit * [x] [input polling in thread](assets/perf_compare.jpg) -* [ ] support non-root git folder wd * [ ] show content of new files * [ ] discard untracked files (remove) * [ ] use [notify](https://crates.io/crates/notify) to watch git diff --git a/src/git_utils.rs b/src/git_utils.rs index 441348ec..eeaa4745 100644 --- a/src/git_utils.rs +++ b/src/git_utils.rs @@ -1,6 +1,7 @@ use git2::{ build::CheckoutBuilder, DiffFormat, DiffOptions, IndexAddOption, - ObjectType, Repository, StatusOptions, StatusShow, + ObjectType, Repository, RepositoryOpenFlags, StatusOptions, + StatusShow, }; use std::path::Path; @@ -91,7 +92,12 @@ pub fn get_diff(p: &Path, stage: bool) -> Diff { /// pub fn repo() -> Repository { - let repo = Repository::init("./").unwrap(); + let repo = Repository::open_ext( + "./", + RepositoryOpenFlags::empty(), + Vec::<&Path>::new(), + ) + .unwrap(); if repo.is_bare() { panic!("bare repo")