mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
enhance: GPG signing settings.
* remove gpg format settings from repository's local setting * add support for X.509 format * ux style
This commit is contained in:
parent
38fd30d431
commit
4b0af79f73
7 changed files with 37 additions and 72 deletions
|
@ -17,12 +17,6 @@ namespace SourceGit.ViewModels
|
|||
set;
|
||||
}
|
||||
|
||||
public Models.GPGFormat GPGFormat
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool GPGCommitSigningEnabled
|
||||
{
|
||||
get;
|
||||
|
@ -60,10 +54,6 @@ namespace SourceGit.ViewModels
|
|||
GPGCommitSigningEnabled = gpgCommitSign == "true";
|
||||
if (_cached.TryGetValue("tag.gpgSign", out var gpgTagSign))
|
||||
GPGTagSigningEnabled = gpgTagSign == "true";
|
||||
if (_cached.TryGetValue("gpg.format", out var gpgFormat))
|
||||
GPGFormat = Models.GPGFormat.Supported.Find(x => x.Value == gpgFormat);
|
||||
else
|
||||
GPGFormat = Models.GPGFormat.OPENPGP;
|
||||
if (_cached.TryGetValue("user.signingkey", out var signingKey))
|
||||
GPGUserSigningKey = signingKey;
|
||||
if (_cached.TryGetValue("http.proxy", out var proxy))
|
||||
|
@ -78,20 +68,19 @@ namespace SourceGit.ViewModels
|
|||
SetIfChanged("user.email", UserEmail);
|
||||
SetIfChanged("commit.gpgsign", GPGCommitSigningEnabled ? "true" : "false");
|
||||
SetIfChanged("tag.gpgSign", GPGTagSigningEnabled ? "true" : "false");
|
||||
SetIfChanged("gpg.format", GPGFormat?.Value, Models.GPGFormat.OPENPGP.Value);
|
||||
SetIfChanged("user.signingkey", GPGUserSigningKey);
|
||||
SetIfChanged("http.proxy", HttpProxy);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SetIfChanged(string key, string value, string defaultValue = null)
|
||||
private void SetIfChanged(string key, string value)
|
||||
{
|
||||
bool changed = false;
|
||||
if (_cached.TryGetValue(key, out var old))
|
||||
{
|
||||
changed = old != value;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(value) && value != defaultValue)
|
||||
else if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue