-
Notifications
You must be signed in to change notification settings - Fork 747
Description
Version
master
Operating System
Linux
Distribution Method
N/A
Describe the issue
I've noted that when gitbutler.signCommits is enabled, I'm prompted to sign twice whenever I make a commit. This is both confusing and rather annoying as I sign with an external key, which is rather slow.
I've tracked the underlying reason down to the fact that the workspace tip (along with the new commit) is updated with the rebase engine here:
gitbutler/crates/but-workspace/src/legacy/commit_engine/mod.rs
Lines 300 to 305 in 508016c
| // We can assume the workspace tip is connected to a pick (or else the rebase will fail) | |
| builder.steps([but_rebase::RebaseStep::Pick { | |
| commit_id, | |
| new_message: None, | |
| }])?; | |
| match builder.rebase() { |
And that eventually ends up creating a signed workspace commit with an underlying create library function, that signs based on the repo settings
gitbutler/crates/but-rebase/src/commit.rs
Line 113 in 508016c
| if settings.gitbutler_sign_commits.unwrap_or(false) { |
I've found several other forms of updating the workspace tip that do not result in signing. For example, if you edit the commit message of a commit or uncommit, the resulting workspace commit is not signed.
How to reproduce (Optional)
Turn on gitbutler.signCommits, then make a commit.
Run git cat-file -p HEAD to see the signed commit.
Expected behavior (Optional)
In my opinion, the workspace commit should never be signed and the bug is that there's (at least) one case where it is signed. The cases where it isn't signed are IMO to be considered "correct" behavior. It doesn't make much sense to sign as it's never pushed to any remote, it's purely a local commit with the sole purpose of facilitating GitButler's local functionality.
I'd love to help out addressing this, but I'm not sure how to go about it. It seems a bit inelegant to temporarily edit the repo settings. My first thought was to perhaps be able to attach specific settings to a rebase step, or at least annotating the rebase step to say that it's the workspace tip so the rebase engine can know to treat it a bit differently.
Any thoughts?