mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
cleanup
This commit is contained in:
parent
9580f8b489
commit
08a8e07322
1 changed files with 3 additions and 21 deletions
|
|
@ -1,8 +1,6 @@
|
|||
use git2::{
|
||||
DiffFormat, DiffOptions, Repository, RepositoryOpenFlags,
|
||||
};
|
||||
use crate::utils;
|
||||
use git2::{DiffFormat, DiffOptions};
|
||||
use scopetime::scope_time;
|
||||
use std::path::Path;
|
||||
|
||||
///
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
|
|
@ -34,7 +32,7 @@ pub struct Diff(pub Vec<DiffLine>);
|
|||
pub fn get_diff(p: String, stage: bool) -> Diff {
|
||||
scope_time!("get_diff");
|
||||
|
||||
let repo = repo();
|
||||
let repo = utils::repo();
|
||||
|
||||
let mut opt = DiffOptions::new();
|
||||
opt.pathspec(p);
|
||||
|
|
@ -90,19 +88,3 @@ pub fn get_diff(p: String, stage: bool) -> Diff {
|
|||
|
||||
Diff(res)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn repo() -> Repository {
|
||||
let repo = Repository::open_ext(
|
||||
"./",
|
||||
RepositoryOpenFlags::empty(),
|
||||
Vec::<&Path>::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
if repo.is_bare() {
|
||||
panic!("bare repo")
|
||||
}
|
||||
|
||||
repo
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue