mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-24 17:45:00 +03:00
cleanup
This commit is contained in:
parent
9580f8b489
commit
08a8e07322
@ -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 New Issue
Block a user