spr
spr copied to clipboard
`spr diff` doesn't GPG sign commits.
@joneshf reported this in #61
- In fact, it will remove the GPG signature when it does whatever changes it does to update the commit.
Yeah, this is a blocker for us because we require signed commits :(
does this plan on getting addressed?
Same here!
So sad, it's a really wonderful tool but no support for it is a deal breaker. Any way to bypass it?
I managed to "fix" it using git2-ext
dependency and some glue code (aka; copy-paste because I struggled to use the interface provided by the library).
I've tested the generated binary, and it was working successfully 🎉.
I've included in the git.rs
file, the following function:
pub fn commit(
repo: &git2::Repository,
author: &git2::Signature<'_>,
committer: &git2::Signature<'_>,
message: &str,
tree: &git2::Tree<'_>,
parents: &[&git2::Commit<'_>],
sign: Option<impl Sign>,
) -> std::result::Result<Oid, git2::Error> {
if let Some(sign) = sign {
let content = repo.commit_create_buffer(author, committer, message, tree, parents)?;
let content = std::str::from_utf8(&content).unwrap();
let signed = sign.sign(content)?;
repo.commit_signed(content, &signed, None)
} else {
repo.commit(None, author, committer, message, tree, parents)
}
}
And every repo.commit
call has been replaced by this:
let new_oid = Self::commit(
&repo,
…
UserSign::from_config(&repo, &repo.config()?).ok()
)?;
I've not been able to use the built-in commit
function from git2-ext
due to types incompatibility (see issue)
The complete modification is available in that branch
Without this issue, I think a PR would be trivial to do to improve the project.