gcr icon indicating copy to clipboard operation
gcr copied to clipboard

Feat: support gpg sigin commit.

Open sdttttt opened this issue 4 years ago • 6 comments

Feature

  • grc will submit with an implicit GPG signature. This feature does not require configuration. (Close #52)

sdttttt avatar Mar 17 '21 06:03 sdttttt

Great job! This PR has 110 quantified lines of changes. It hits the sweet spot of 50 to 200 lines for the best PR experience!


Quantification details

Label      : Medium
Size       : +85 -25
Percentile : 42%

Total files changed: 6

Change summary by file extension:
.rs : +85 -25

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a balance between between PR complexity and PR review overhead. PRs within the optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detetcted.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification) of this PR in relation to all other PRs within the repository.


Was this comment helpful? :thumbsup:  :ok_hand:  :thumbsdown: (Email) Customize PullRequestQuantifier for this repository.

Codecov Report

Merging #53 (649a01c) into develop (c4e190b) will decrease coverage by 2.58%. The diff coverage is 11.29%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #53      +/-   ##
===========================================
- Coverage    40.82%   38.24%   -2.59%     
===========================================
  Files           11       11              
  Lines          556      604      +48     
===========================================
+ Hits           227      231       +4     
- Misses         329      373      +44     
Impacted Files Coverage Δ
src/main.rs 0.00% <0.00%> (ø)
src/message.rs 21.95% <0.00%> (ø)
src/plugins/push.rs 0.00% <0.00%> (ø)
src/repo.rs 0.00% <0.00%> (ø)
src/util.rs 79.77% <0.00%> (-8.98%) :arrow_down:
src/log.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c4e190b...649a01c. Read the comment docs.

codecov[bot] avatar Mar 17 '21 06:03 codecov[bot]

progress report

Recently, I realized that perfectly supporting gpg in git2-rs is not an easy task. the main library currently implementing gpg signature separation in Rust is gpgme. and gpgme relies on some complex link libraries. Makes gpgme not so easy to run on non-unix platforms (I need grc to be cross-platform ), and this may currently disrupt grc workflows. I'll try to find a more reasonable implementation of Rust for the gpg signature.

Ref

  • https://github.com/gpg-rs/gpgme/issues/31
  • https://github.com/extrawurst/gitui/pull/219
  • https://github.com/extrawurst/gitui/issues/97

sdttttt avatar Mar 19 '21 02:03 sdttttt

We had the same feature request for git-cm: https://github.com/SirWindfield/git-cm/issues/16. I hesitated as well as I couldn't get Windows support to work. Linking gpgme on Windows is unreliable as not everybody has Gpg4Win installed. Secondly, it would force the binary to run in 32bit mode. Not a dramatic consequence, but one that you should be aware off.

If you figure out an alternative, let me know :)

mainrs avatar Mar 21 '21 12:03 mainrs

@SirWindfield, as you said, the FFI compilation of gpg-rs/ gpgme does cause some trouble for non-unix platforms, so I'm recently looking for a more native GPG implementation in Rust. What has caught my attention are two GPG implementations that might be helpful, gpgrv and sequoia- openpgp, but they have one thing in common, that is, the API provided is more low-level and obscure. I don't know the details of OpenGPG encryption. It is very difficult for me to start with them.


发件人: SirWindfield 发送时间: 2021年3月21日 20:09 收件人: sdttttt/gcr 抄送: Ryn; Assign 主题: Re: [sdttttt/gcr] Feat: support gpg sigin commit. (#53)

We had the same feature request for git-cm: SirWindfield/git-cm#16. I hesitated as well as I couldn't get Windows support to work. Linking gpgme on Windows is unreliable as not everybody has Gpg4Win installed. Secondly, it would force the binary to run in 32bit mode. Not a dramatic consequence, but one that you should be aware off. If you figure out an alternative, let me know :) — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or unsubscribe.

sdttttt avatar Mar 22 '21 00:03 sdttttt

I'm in the same boat. I have not much internal knowledge of GPG to be confident enough to provide an implementation that I can be sure of works properly. That's why I didn't implement the feature for now. I've opened an issue for sequoia to see what the scope of an implementation would be (whether the chunk of code I'd have to manage would be on the large side). Thanks for answering me!

mainrs avatar Mar 22 '21 00:03 mainrs