~/selfhut

d91f772352128205c6e10a3781e37aca58110289 — Arthur Melton 77419c97 2 years ago
undo patch
1 files changed, 1 insertions(+), 8 deletions(-)

M src/repository/commit.rs
M src/repository/commit.rs => src/repository/commit.rs +1 -8
@@ 126,15 126,8 @@ pub fn patch(repo: String, oid: String) -> Option<String> {

    let repo_clone = repo.clone();
    let repo = git2::Repository::open(repo_path).ok()?;
    let commit = repo.find_commit(git2::Oid::from_str(&oid).ok()?).ok()?;
    let mut data = "".to_string();
    let diff = diffs(commit, &repo)?;
    let mut x = 0;
    for i in diff.deltas() {
        let mut patch = git2::Patch::from_diff(&diff, x).ok()??;
        data.push_str(patch.to_buf().ok()?.as_str()?);
        x+=1;
    }
    Some(data)
    None
}

#[derive(Serialize, Clone)]