aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/command.go')
-rw-r--r--modules/git/command.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/git/command.go b/modules/git/command.go
index 347dcfe39f..2b5288aeab 100644
--- a/modules/git/command.go
+++ b/modules/git/command.go
@@ -9,6 +9,7 @@ import (
"context"
"fmt"
"io"
+ "os"
"os/exec"
"strings"
"time"
@@ -24,6 +25,9 @@ var (
DefaultCommandExecutionTimeout = 60 * time.Second
)
+// DefaultLocale is the default LC_ALL to run git commands in.
+const DefaultLocale = "C"
+
// Command represents a command with its subcommands or arguments.
type Command struct {
name string
@@ -77,7 +81,12 @@ func (c *Command) RunInDirTimeoutEnvFullPipeline(env []string, timeout time.Dura
defer cancel()
cmd := exec.CommandContext(ctx, c.name, c.args...)
- cmd.Env = env
+ if env == nil {
+ cmd.Env = append(os.Environ(), fmt.Sprintf("LC_ALL=%s", DefaultLocale))
+ } else {
+ cmd.Env = env
+ cmd.Env = append(cmd.Env, fmt.Sprintf("LC_ALL=%s", DefaultLocale))
+ }
cmd.Dir = dir
cmd.Stdout = stdout
cmd.Stderr = stderr