Skip to content

Commit

Permalink
signing: allow disabling by setting backend to "none"
Browse files Browse the repository at this point in the history
We don't seem to have a way to override the config to disable
signing. This patch lets you do that by setting
`signing.backend="none"`.
  • Loading branch information
martinvonz committed Sep 6, 2024
1 parent 8f603f1 commit fee706d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cli/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@
"backend": {
"type": "string",
"enum": ["gpg", "ssh"],
"description": "The backend to use for signing commits"
"description": "The backend to use for signing commits. The string `none` disables signing.",
"default": "none"
},
"key": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ GnuPG or SSH signing keys.

To do this you need to configure a signing backend.

Setting the backend to `"none"` disables signing.

### GnuPG Signing

```toml
Expand Down
3 changes: 2 additions & 1 deletion lib/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ impl UserSettings {
// separate from sign_settings as those two are needed in pretty different
// places
pub fn signing_backend(&self) -> Option<String> {
self.config.get_string("signing.backend").ok()
let backend = self.config.get_string("signing.backend").ok()?;
(backend.as_str() != "none").then_some(backend)
}

pub fn sign_settings(&self) -> SignSettings {
Expand Down

0 comments on commit fee706d

Please sign in to comment.