github.com/golang/dep@v0.5.4/gps/cmd.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package gps
     6  
     7  import (
     8  	"os"
     9  )
    10  
    11  func (c cmd) Args() []string {
    12  	return c.Cmd.Args
    13  }
    14  
    15  func (c cmd) SetDir(dir string) {
    16  	c.Cmd.Dir = dir
    17  }
    18  
    19  func (c cmd) SetEnv(env []string) {
    20  	c.Cmd.Env = env
    21  }
    22  
    23  func init() {
    24  	// For our git repositories, we very much assume a "regular" topology.
    25  	// Therefore, no value for the following variables can be relevant to
    26  	// us. Unsetting globally properly propagates to libraries like
    27  	// github.com/Masterminds/vcs, which cannot make the same assumption in
    28  	// general.
    29  	parasiteGitVars := []string{"GIT_DIR", "GIT_INDEX_FILE", "GIT_OBJECT_DIRECTORY", "GIT_WORK_TREE"}
    30  	for _, e := range parasiteGitVars {
    31  		os.Unsetenv(e)
    32  	}
    33  }