revert some stuff

This commit is contained in:
Stephan Dilly 2021-05-09 17:54:20 +02:00
parent 15054fed81
commit 593a1d6d98
2 changed files with 5 additions and 11 deletions

View file

@ -180,7 +180,7 @@ pub fn get_diff(
let work_dir = work_dir(&repo)?;
let diff = get_diff_raw(&repo, p, stage, false, None)?;
raw_diff_to_file_diff(&diff, &work_dir)
raw_diff_to_file_diff(&diff, work_dir)
}
/// returns diff of a specific file inside a commit
@ -196,7 +196,7 @@ pub fn get_diff_commit(
let work_dir = work_dir(&repo)?;
let diff = get_commit_diff(&repo, id, Some(p))?;
raw_diff_to_file_diff(&diff, &work_dir)
raw_diff_to_file_diff(&diff, work_dir)
}
///

View file

@ -4,11 +4,7 @@ use super::CommitId;
use crate::error::{Error, Result};
use git2::{IndexAddOption, Repository, RepositoryOpenFlags};
use scopetime::scope_time;
use std::{
fs::File,
io::Write,
path::{Path, PathBuf},
};
use std::{fs::File, io::Write, path::Path};
///
#[derive(PartialEq, Debug, Clone)]
@ -56,10 +52,8 @@ pub(crate) fn repo(repo_path: &str) -> Result<Repository> {
}
///
pub(crate) fn work_dir(repo: &Repository) -> Result<PathBuf> {
let path = repo.workdir().ok_or(Error::NoWorkDir)?;
Ok(path.into())
pub(crate) fn work_dir(repo: &Repository) -> Result<&Path> {
repo.workdir().ok_or(Error::NoWorkDir)
}
///