fix: assure commit.gpgsign is detected correctly

Avoid stringly comparison for what is definitely a boolean
[as per the configuration](https://git-scm.com/docs/git-config#Documentation/git-config.txt-commitgpgSign).
This commit is contained in:
Sebastian Thiel 2024-05-23 10:15:56 +02:00
parent 93508d7e7c
commit e3b8e2a5e5
No known key found for this signature in database
GPG Key ID: 9CB5EE7895E8268B

View File

@ -285,8 +285,8 @@ impl Repository {
/// returns an oid of the new commit object
pub fn commit_buffer(&self, buffer: String) -> Result<git2::Oid> {
// check git config for gpg.signingkey
let should_sign = self.0.config()?.get_string("commit.gpgSign");
if should_sign.unwrap_or("false".to_string()) != "false" {
let should_sign = self.0.config()?.get_bool("commit.gpgSign").unwrap_or(false);
if should_sign {
// TODO: support gpg.ssh.defaultKeyCommand to get the signing key if this value doesn't exist
let signing_key = self.0.config()?.get_string("user.signingkey");
if let Ok(signing_key) = signing_key {