fix(data): force English git output for locale-fragile stderr matches
RevParseHeadAsync and CommitAsync's identity-error detection match English-only substrings against git stderr. Under a non-English OS/git locale these silently fail to match, falling through to a generic error. Force LC_ALL=C and LANGUAGE=C on the git ProcessStartInfo so git always emits English output regardless of ambient locale.
This commit is contained in:
@@ -704,6 +704,11 @@ public sealed class GitService
|
||||
// (mktree "input format error") and would prepend to stdin commit messages.
|
||||
StandardInputEncoding = stdinData is not null ? new UTF8Encoding(false) : null,
|
||||
};
|
||||
// Force English stderr/stdout so the English-only substring matches below
|
||||
// (e.g. "ambiguous argument 'HEAD'", "tell me who you are") work regardless
|
||||
// of the OS locale git for Windows picks up.
|
||||
psi.Environment["LC_ALL"] = "C";
|
||||
psi.Environment["LANGUAGE"] = "C";
|
||||
psi.ArgumentList.Add("-C");
|
||||
psi.ArgumentList.Add(workDir);
|
||||
foreach (var a in args) psi.ArgumentList.Add(a);
|
||||
|
||||
Reference in New Issue
Block a user