diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml
index d3c86338..000258d3 100644
--- a/src/Resources/Locales/en_US.xaml
+++ b/src/Resources/Locales/en_US.xaml
@@ -91,11 +91,11 @@
FILES
Configure
- User :
+ User Name
User name for this repository
- Email :
+ Email Address
Email address
- Proxy :
+ HTTP Proxy
HTTP proxy used by this repository
Create Branch
@@ -507,6 +507,13 @@
By Recently Opened
By Bookmark Color
+ GPG SIGNING
+ Commit GPG signing
+ Install Path
+ Input path for installed gpg program
+ User Signing Key
+ User's gpg signing key
+
Git has NOT been configured. Please to go [Preference] and configure it first.
Path[{0}] not exists!
Can NOT locate bash.exe. Make sure bash.exe exists under the same folder with git.exe
diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml
index 8ef1cdf2..e6c298d0 100644
--- a/src/Resources/Locales/zh_CN.xaml
+++ b/src/Resources/Locales/zh_CN.xaml
@@ -90,11 +90,11 @@
文件列表
仓库配置
- 用户 :
+ 用户名
应用于本仓库的用户名
- 邮箱 :
+ 电子邮箱
邮箱地址
- 代理 :
+ HTTP代理
HTTP网络代理
新建分支
@@ -506,6 +506,13 @@
按最近访问
按书签颜色
+ GPG签名
+ 启用提交签名
+ 可执行文件位置
+ gpg.exe所在路径
+ 用户签名KEY
+ 输入签名提交所使用的KEY
+
GIT尚未配置。请打开【偏好设置】配置GIT路径。
路径({0})不存在或不可读取!
无法找到bash.exe,请确保其在git.exe同目录中!
diff --git a/src/Views/Popups/Configure.xaml b/src/Views/Popups/Configure.xaml
index f3ce320d..58ed4519 100644
--- a/src/Views/Popups/Configure.xaml
+++ b/src/Views/Popups/Configure.xaml
@@ -13,6 +13,8 @@
+
+
@@ -52,5 +54,25 @@
Text="{Binding ElementName=me, Path=Proxy, Mode=TwoWay}"
Height="24"
Placeholder="{DynamicResource Text.Configure.Proxy.Placeholder}"/>
+
+
+
+
+
+
diff --git a/src/Views/Popups/Configure.xaml.cs b/src/Views/Popups/Configure.xaml.cs
index 23f92115..2619ce16 100644
--- a/src/Views/Popups/Configure.xaml.cs
+++ b/src/Views/Popups/Configure.xaml.cs
@@ -9,6 +9,8 @@ namespace SourceGit.Views.Popups {
public string UserName { get; set; }
public string UserEmail { get; set; }
+ public bool GPGSigningEnabled { get; set; }
+ public string GPGUserSigningKey { get; set; }
public string Proxy { get; set; }
public Configure(string repo) {
@@ -17,6 +19,8 @@ namespace SourceGit.Views.Popups {
var cmd = new Commands.Config(repo);
UserName = cmd.Get("user.name");
UserEmail = cmd.Get("user.email");
+ GPGSigningEnabled = cmd.Get("commit.gpgsign") == "true";
+ GPGUserSigningKey = cmd.Get("user.signingkey");
Proxy = cmd.Get("http.proxy");
InitializeComponent();
@@ -36,6 +40,11 @@ namespace SourceGit.Views.Popups {
if (oldEmail != UserEmail) cmd.Set("user.email", UserEmail);
var oldProxy = cmd.Get("http.proxy");
if (oldProxy != Proxy) cmd.Set("http.proxy", Proxy);
+ var oldGPGSigningEnabled = cmd.Get("commit.gpgsign") == "true";
+ if (oldGPGSigningEnabled != GPGSigningEnabled) cmd.Set("commit.gpgsign", GPGSigningEnabled ? "true" : "false");
+ var oldGPGUserSigningKey = cmd.Get("user.signingkey");
+ if (oldGPGUserSigningKey != GPGUserSigningKey) cmd.Set("user.signingkey", GPGUserSigningKey);
+
return true;
});
}
diff --git a/src/Views/Preference.xaml b/src/Views/Preference.xaml
index 201bce1a..13819467 100644
--- a/src/Views/Preference.xaml
+++ b/src/Views/Preference.xaml
@@ -287,6 +287,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -295,7 +358,7 @@
-
+
diff --git a/src/Views/Preference.xaml.cs b/src/Views/Preference.xaml.cs
index fae97234..496b6050 100644
--- a/src/Views/Preference.xaml.cs
+++ b/src/Views/Preference.xaml.cs
@@ -15,6 +15,9 @@ namespace SourceGit.Views {
public string Email { get; set; }
public string CRLF { get; set; }
public string Version { get; set; }
+ public string GPGExec { get; set; }
+ public bool GPGSigningEnabled { get; set; }
+ public string GPGUserSigningKey { get; set; }
public Preference() {
UpdateGitInfo(false);
@@ -24,22 +27,35 @@ namespace SourceGit.Views {
private bool UpdateGitInfo(bool updateUi) {
var isReady = Models.Preference.Instance.IsReady;
if (isReady) {
- User = new Commands.Config().Get("user.name");
- Email = new Commands.Config().Get("user.email");
- CRLF = new Commands.Config().Get("core.autocrlf");
+ var cmd = new Commands.Config();
+ User = cmd.Get("user.name");
+ Email = cmd.Get("user.email");
+ CRLF = cmd.Get("core.autocrlf");
Version = new Commands.Version().Query();
if (string.IsNullOrEmpty(CRLF)) CRLF = "false";
+ GPGExec = cmd.Get("gpg.program");
+ if (string.IsNullOrEmpty(GPGExec)) {
+ string gitInstallFolder = Path.GetDirectoryName(Models.Preference.Instance.Git.Path);
+ string defaultGPG = Path.GetFullPath(Path.Join(gitInstallFolder, "..", "usr", "bin", "gpg.exe"));
+ if (File.Exists(defaultGPG)) GPGExec = defaultGPG;
+ }
+ GPGSigningEnabled = cmd.Get("commit.gpgsign") == "true";
+ GPGUserSigningKey = cmd.Get("user.signingkey");
} else {
User = "";
Email = "";
CRLF = "false";
Version = "Unknown";
+ GPGExec = "";
+ GPGSigningEnabled = false;
+ GPGUserSigningKey = "";
}
if (updateUi) {
editGitUser?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
editGitEmail?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
editGitCrlf?.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateTarget();
textGitVersion?.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
+ txtGPGExec?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
}
return isReady;
}
@@ -81,6 +97,19 @@ namespace SourceGit.Views {
}
}
+ private void SelectGPGExec(object sender, RoutedEventArgs e) {
+ var dialog = new OpenFileDialog();
+ dialog.Filter = $"GPG Executable|gpg.exe";
+ dialog.Title = App.Text("Text.GPG.Path.Placeholder");
+ dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
+ dialog.CheckFileExists = true;
+
+ if (dialog.ShowDialog() == true) {
+ GPGExec = dialog.FileName;
+ txtGPGExec?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
+ }
+ }
+
private void SelectMergeTool(object sender, RoutedEventArgs e) {
var type = Models.Preference.Instance.MergeTool.Type;
var tool = Models.MergeTool.Supported.Find(x => x.Type == type);
@@ -123,6 +152,16 @@ namespace SourceGit.Views {
var oldCRLF = cmd.Get("core.autocrlf");
if (oldCRLF != CRLF) cmd.Set("core.autocrlf", CRLF);
+
+ var oldGPGExec = cmd.Get("gpg.program");
+ if (oldGPGExec != GPGExec) cmd.Set("gpg.program", GPGExec);
+
+ var oldGPGSigningEnabledStr = cmd.Get("commit.gpgsign");
+ var oldGPGSigningEnabled = "true" == oldGPGSigningEnabledStr;
+ if (oldGPGSigningEnabled != GPGSigningEnabled) cmd.Set("commit.gpgsign", GPGSigningEnabled ? "true" : "false");
+
+ var oldGPGUserSigningKey = cmd.Get("user.signingkey");
+ if (oldGPGUserSigningKey != GPGUserSigningKey) cmd.Set("user.signingkey", GPGUserSigningKey);
}
Models.Preference.Save();