Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hegyi <ahegyi@gitlab.com>2019-09-25 16:07:04 +0300
committerAdam Hegyi <ahegyi@gitlab.com>2019-09-25 16:07:13 +0300
commitb8ab23910827fd77f38be5cc6ba958837f906e78 (patch)
treee94a118e24dae75b8cf1630150ba667e2e369db6
parentafe710b7cbe1873b44171b196311ef2e0c699148 (diff)
Use os.Environ() for git-linguistpass-full-env-to-git-linguist
-rw-r--r--internal/linguist/linguist.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/internal/linguist/linguist.go b/internal/linguist/linguist.go
index 419f22993..8744ddc47 100644
--- a/internal/linguist/linguist.go
+++ b/internal/linguist/linguist.go
@@ -19,8 +19,6 @@ func init() {
config.RegisterHook(LoadColors)
}
-var exportedEnvVars = []string{"HOME", "PATH", "GEM_HOME", "BUNDLE_PATH", "BUNDLE_APP_CONFIG"}
-
var (
colorMap = make(map[string]Language)
)
@@ -106,8 +104,7 @@ func startGitLinguist(ctx context.Context, repoPath string, commitID string, lin
cmd := exec.Command("bundle", "exec", "bin/ruby-cd", repoPath, "git-linguist", "--commit="+commitID, linguistCommand)
cmd.Dir = config.Config.Ruby.Dir
- var env []string
- reader, err := command.New(ctx, cmd, nil, nil, nil, exportEnvironment(env)...)
+ reader, err := command.New(ctx, cmd, nil, nil, nil, os.Environ()...)
if err != nil {
return nil, err
}
@@ -154,13 +151,3 @@ func openLanguagesJSON(cfg config.Cfg) (io.ReadCloser, error) {
return os.Open(path.Join(linguistPathSymlink.Name(), "lib/linguist/languages.json"))
}
-
-func exportEnvironment(env []string) []string {
- for _, envVarName := range exportedEnvVars {
- if val, ok := os.LookupEnv(envVarName); ok {
- env = append(env, fmt.Sprintf("%s=%s", envVarName, val))
- }
- }
-
- return env
-}