mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
enhance: do not save gpg.openpgp.program
if gpg.program
exists and the value has not been changed (#544)
This commit is contained in:
parent
c8a13bc4e9
commit
14334b08d2
1 changed files with 16 additions and 1 deletions
|
@ -137,7 +137,22 @@ namespace SourceGit.Views
|
|||
SetIfChanged(config, "gpg.format", GPGFormat.Value, "openpgp");
|
||||
|
||||
if (!GPGFormat.Value.Equals("ssh", StringComparison.Ordinal))
|
||||
SetIfChanged(config, $"gpg.{GPGFormat.Value}.program", GPGExecutableFile, "");
|
||||
{
|
||||
var oldGPG = string.Empty;
|
||||
if (GPGFormat.Value == "openpgp" && config.TryGetValue("gpg.program", out var openpgp))
|
||||
oldGPG = openpgp;
|
||||
else if (config.TryGetValue($"gpg.{GPGFormat.Value}.program", out var gpgProgram))
|
||||
oldGPG = gpgProgram;
|
||||
|
||||
bool changed = false;
|
||||
if (!string.IsNullOrEmpty(oldGPG))
|
||||
changed = oldGPG != GPGExecutableFile;
|
||||
else if (!string.IsNullOrEmpty(GPGExecutableFile))
|
||||
changed = true;
|
||||
|
||||
if (changed)
|
||||
new Commands.Config(null).Set($"gpg.{GPGFormat.Value}.program", GPGExecutableFile);
|
||||
}
|
||||
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue