Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spr diff doesn't GPG sign commits. #64

Open
Tracked by #61
sven-of-cord opened this issue Jun 13, 2022 · 5 comments
Open
Tracked by #61

spr diff doesn't GPG sign commits. #64

sven-of-cord opened this issue Jun 13, 2022 · 5 comments

Comments

@sven-of-cord
Copy link
Contributor

sven-of-cord commented Jun 13, 2022

@joneshf reported this in #61

  • In fact, it will remove the GPG signature when it does whatever changes it does to update the commit.
@sven-of-cord sven-of-cord changed the title doesn't GPG sign commits. spr diff doesn't GPG sign commits. Jun 13, 2022
@jduan-highnote
Copy link

Yeah, this is a blocker for us because we require signed commits :(

@dukeofcool199
Copy link

does this plan on getting addressed?

@balena-zh
Copy link

Same here!

@davinkevin
Copy link

So sad, it's a really wonderful tool but no support for it is a deal breaker.
Any way to bypass it?

@davinkevin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants