This commit is contained in:
Stephan Dilly 2020-03-23 00:17:29 +01:00
parent 9580f8b489
commit 08a8e07322

View File

@ -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
}