From 249706c1efdb1fa1a3ec658d9cc41c1b3481bcf2 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 9 Oct 2024 11:55:24 +0800 Subject: [PATCH] fix: turn off `GPG Signing` when create a new tag does not work if `tag.gpgsign` is enabled --- src/Commands/Tag.cs | 2 +- src/ViewModels/CreateTag.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Commands/Tag.cs b/src/Commands/Tag.cs index 5fe57f94..fa11e366 100644 --- a/src/Commands/Tag.cs +++ b/src/Commands/Tag.cs @@ -16,7 +16,7 @@ namespace SourceGit.Commands public static bool Add(string repo, string name, string basedOn, string message, bool sign) { - var param = sign ? "-s -a" : "-a"; + var param = sign ? "--sign -a" : "--no-sign -a"; var cmd = new Command(); cmd.WorkingDirectory = repo; cmd.Context = repo; diff --git a/src/ViewModels/CreateTag.cs b/src/ViewModels/CreateTag.cs index 7318e00e..af9dcf99 100644 --- a/src/ViewModels/CreateTag.cs +++ b/src/ViewModels/CreateTag.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; namespace SourceGit.ViewModels @@ -50,6 +51,7 @@ namespace SourceGit.ViewModels _basedOn = branch.Head; BasedOn = branch; + SignTag = new Commands.Config(repo.FullPath).Get("tag.gpgsign").Equals("true", StringComparison.OrdinalIgnoreCase); View = new Views.CreateTag() { DataContext = this }; } @@ -59,6 +61,7 @@ namespace SourceGit.ViewModels _basedOn = commit.SHA; BasedOn = commit; + SignTag = new Commands.Config(repo.FullPath).Get("tag.gpgsign").Equals("true", StringComparison.OrdinalIgnoreCase); View = new Views.CreateTag() { DataContext = this }; }