Skip to content

Commit

Permalink
When deleting password files, git state isn't correct.
Browse files Browse the repository at this point in the history
What happened was that the inverse state of the last commit was added to the index after the commit, so the index needed to be reset
  • Loading branch information
alexanderkjall committed Aug 30, 2019
1 parent fb3b589 commit 54bfecc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,14 @@ fn remove_and_commit(repo: &git2::Repository, paths: &Vec<String>, message: &str
return Err(Error::Git(commit.unwrap_err()));
}

return Ok(commit.unwrap());
let oid = commit.unwrap();
let obj = repo.find_object(oid, None).unwrap();
let reset = repo.reset(&obj, git2::ResetType::Hard, None);
if reset.is_err() {
return Err(Error::Git(reset.unwrap_err()));
}

return Ok(oid);
}

pub struct Signer {
Expand Down

0 comments on commit 54bfecc

Please sign in to comment.