mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
support non root repo open
This commit is contained in:
parent
44bb85091f
commit
cb42dca0a3
2 changed files with 8 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue