From 0f9087fac6088712240a3b109ed8e469162a9c9f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 10 Mar 2025 20:08:42 +0800 Subject: [PATCH] code_review: PR #1078 - Remove `ForceEnglishLocale` because we want all `git` outputs in English - Remove locale settings for `ExecuteCustomAction` Signed-off-by: leo --- src/Commands/Command.cs | 5 ++--- src/Commands/ExecuteCustomAction.cs | 14 -------------- src/Commands/QueryBranches.cs | 1 - 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index f0896526..a3e6673b 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -37,7 +37,6 @@ namespace SourceGit.Commands public string Args { get; set; } = string.Empty; public bool RaiseError { get; set; } = true; public bool TraitErrorAsOutput { get; set; } = false; - protected bool ForceEnglishLocale { get; set; } = false; public bool Exec() { @@ -193,8 +192,8 @@ namespace SourceGit.Commands if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey)) start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'"); - // Force using en_US.UTF-8 locale to avoid GCM crash - if (ForceEnglishLocale || OperatingSystem.IsLinux()) + // Force using en_US.UTF-8 locale + if (OperatingSystem.IsLinux()) { start.Environment.Add("LANG", "C"); start.Environment.Add("LC_ALL", "C"); diff --git a/src/Commands/ExecuteCustomAction.cs b/src/Commands/ExecuteCustomAction.cs index e343700f..894637a5 100644 --- a/src/Commands/ExecuteCustomAction.cs +++ b/src/Commands/ExecuteCustomAction.cs @@ -17,13 +17,6 @@ namespace SourceGit.Commands start.CreateNoWindow = true; 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 if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv)) start.Environment.Add("PATH", Native.OS.CustomPathEnv); @@ -51,13 +44,6 @@ namespace SourceGit.Commands start.StandardErrorEncoding = Encoding.UTF8; 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 if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv)) start.Environment.Add("PATH", Native.OS.CustomPathEnv); diff --git a/src/Commands/QueryBranches.cs b/src/Commands/QueryBranches.cs index effd25b0..44438cef 100644 --- a/src/Commands/QueryBranches.cs +++ b/src/Commands/QueryBranches.cs @@ -14,7 +14,6 @@ namespace SourceGit.Commands { WorkingDirectory = repo; Context = repo; - ForceEnglishLocale = true; Args = "branch -l --all -v --format=\"%(refname)%00%(objectname)%00%(HEAD)%00%(upstream)%00%(upstream:trackshort)\""; }