From 02cf539a085db336ee5582d05640150e74a2cd18 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 7 Feb 2023 13:26:25 +0100 Subject: [PATCH] gitutil: override the locale to ensure consistent output Signed-off-by: CrazyMax (cherry picked from commit a8eb2a7fbe3fe316ec428bf1c723815afac1b128) --- util/gitutil/gitutil.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/gitutil/gitutil.go b/util/gitutil/gitutil.go index 3aa33013..74ec513e 100644 --- a/util/gitutil/gitutil.go +++ b/util/gitutil/gitutil.go @@ -3,6 +3,7 @@ package gitutil import ( "bytes" "context" + "os" "os/exec" "strings" @@ -116,6 +117,9 @@ func (c *Git) run(args ...string) (string, error) { cmd.Dir = c.wd } + // Override the locale to ensure consistent output + cmd.Env = append(os.Environ(), "LC_ALL=C") + stdout := bytes.Buffer{} stderr := bytes.Buffer{} cmd.Stdout = &stdout