diff options
author | Alejandro Rodríguez <alejorro70@gmail.com> | 2018-10-05 01:22:19 +0300 |
---|---|---|
committer | Alejandro Rodríguez <alejorro70@gmail.com> | 2018-10-11 19:57:37 +0300 |
commit | a84e496aaa40091bf5d01fbe7bcd60e9ff135c95 (patch) | |
tree | c0dfb662b0b0e929f608e141c508854628bc646b /internal | |
parent | b838af9869fad5cd02809aa7417d4de16a5873e2 (diff) |
Force english output on git commands
For some reason my git got localized in spanish, and we had some tests
failing because they relied on error messages being on english, as well
as some code failing if the text wasn't ASCII-8BIT compatible. These
changes fix those issues.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/git/command.go | 9 | ||||
-rw-r--r-- | internal/rubyserver/rubyserver.go | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/internal/git/command.go b/internal/git/command.go index 45f569c37..408221010 100644 --- a/internal/git/command.go +++ b/internal/git/command.go @@ -9,9 +9,18 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/git/alternates" ) +// GitEnv contains the ENV variables for git commands +var GitEnv = []string{ + // Force english locale for consistency on the output messages + "LANG=en_US.UTF-8", +} + // Command creates a git.Command with the given args func Command(ctx context.Context, repo *gitalypb.Repository, args ...string) (*command.Command, error) { repoPath, env, err := alternates.PathAndEnv(repo) + + env = append(env, GitEnv...) + if err != nil { return nil, err } diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go index 7b7cedbbd..fa4d9db9b 100644 --- a/internal/rubyserver/rubyserver.go +++ b/internal/rubyserver/rubyserver.go @@ -14,6 +14,7 @@ import ( "gitlab.com/gitlab-org/gitaly-proto/go/gitalypb" "gitlab.com/gitlab-org/gitaly/internal/command" "gitlab.com/gitlab-org/gitaly/internal/config" + "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/helper" "gitlab.com/gitlab-org/gitaly/internal/rubyserver/balancer" "gitlab.com/gitlab-org/gitaly/internal/supervisor" @@ -109,6 +110,9 @@ func Start() (*Server, error) { "GITALY_RUBY_GITALY_BIN_DIR="+cfg.BinDir, "GITALY_VERSION="+version.GetVersion(), ) + + env = append(env, git.GitEnv...) + if dsn := cfg.Logging.RubySentryDSN; dsn != "" { env = append(env, "SENTRY_DSN="+dsn) } |