code_review: PR #1078

- Remove `ForceEnglishLocale` because we want all `git` outputs in English
- Remove locale settings for `ExecuteCustomAction`

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-10 20:08:42 +08:00
parent 860f52153b
commit 0f9087fac6
No known key found for this signature in database
3 changed files with 2 additions and 18 deletions

View file

@ -37,7 +37,6 @@ namespace SourceGit.Commands
public string Args { get; set; } = string.Empty; public string Args { get; set; } = string.Empty;
public bool RaiseError { get; set; } = true; public bool RaiseError { get; set; } = true;
public bool TraitErrorAsOutput { get; set; } = false; public bool TraitErrorAsOutput { get; set; } = false;
protected bool ForceEnglishLocale { get; set; } = false;
public bool Exec() public bool Exec()
{ {
@ -193,8 +192,8 @@ namespace SourceGit.Commands
if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey)) if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey))
start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'"); start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'");
// Force using en_US.UTF-8 locale to avoid GCM crash // Force using en_US.UTF-8 locale
if (ForceEnglishLocale || OperatingSystem.IsLinux()) if (OperatingSystem.IsLinux())
{ {
start.Environment.Add("LANG", "C"); start.Environment.Add("LANG", "C");
start.Environment.Add("LC_ALL", "C"); start.Environment.Add("LC_ALL", "C");

View file

@ -17,13 +17,6 @@ namespace SourceGit.Commands
start.CreateNoWindow = true; start.CreateNoWindow = true;
start.WorkingDirectory = repo; start.WorkingDirectory = repo;
// Force using en_US.UTF-8 locale to avoid GCM crash
if (OperatingSystem.IsLinux())
{
start.Environment.Add("LANG", "C");
start.Environment.Add("LC_ALL", "C");
}
// Fix macOS `PATH` env // Fix macOS `PATH` env
if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv)) if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv))
start.Environment.Add("PATH", Native.OS.CustomPathEnv); start.Environment.Add("PATH", Native.OS.CustomPathEnv);
@ -51,13 +44,6 @@ namespace SourceGit.Commands
start.StandardErrorEncoding = Encoding.UTF8; start.StandardErrorEncoding = Encoding.UTF8;
start.WorkingDirectory = repo; start.WorkingDirectory = repo;
// Force using en_US.UTF-8 locale to avoid GCM crash
if (OperatingSystem.IsLinux())
{
start.Environment.Add("LANG", "C");
start.Environment.Add("LC_ALL", "C");
}
// Fix macOS `PATH` env // Fix macOS `PATH` env
if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv)) if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv))
start.Environment.Add("PATH", Native.OS.CustomPathEnv); start.Environment.Add("PATH", Native.OS.CustomPathEnv);

View file

@ -14,7 +14,6 @@ namespace SourceGit.Commands
{ {
WorkingDirectory = repo; WorkingDirectory = repo;
Context = repo; Context = repo;
ForceEnglishLocale = true;
Args = "branch -l --all -v --format=\"%(refname)%00%(objectname)%00%(HEAD)%00%(upstream)%00%(upstream:trackshort)\""; Args = "branch -l --all -v --format=\"%(refname)%00%(objectname)%00%(HEAD)%00%(upstream)%00%(upstream:trackshort)\"";
} }