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

[WIP] Support GPG-signing commits #966

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tommyip
Copy link

@tommyip tommyip commented Jun 14, 2023

This is a work in progress, just wanted to publish it early to gather some feedback.

TODO:

  • git record (calls git commit directly so signing already works in master, added new flags to override keyid or disable signing)
  • git amend
  • git move
    • in-memory
    • on-disk
  • git sync
  • git restack
  • git reword
  • git test
    git branchless snapshot create

Also looking in ways to write integration tests for this. Generating keys through gpg and using them in tests seems a bit cumbersome.

Fixes #465

@arxanas
Copy link
Owner

arxanas commented Jun 19, 2023

Thanks for looking into it!

git branchless snapshot create

We shouldn't need/want to sign snapshot commits (although you can if it's easier). These are just meant to store the working copy state to either attach to a real commit later (which would be signed at that time) or to restore the working copy state (which doesn't need to be signed).

Also looking in ways to write integration tests for this. Generating keys through gpg and using them in tests seems a bit cumbersome.

Would you be able to generate a single key ahead of time and commit it to the repo? Although I don't know if that would remove the dependency on gpg at test-time.

(_, Some("") | None) => {
let signer = git2_ext::ops::UserSign::from_config(&repo.inner, &config)
.map_err(RepoError::ReadConfig)?;
Box::new(signer) as Box<dyn git2_ext::ops::Sign>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely you can ignore the warning about

using a potentially dangerous silent `as` conversion

here. That's meant for numeric types (like u32 <-> u64), but it looks like git2_ext::ops::Sign is not a numeric type, so I don't know why the warning is triggereing here.

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

Successfully merging this pull request may close these issues.

Support GPG-signing commits
2 participants