config,etc: remove uses of GetenvBool

This commit is contained in:
Taylor Blau 2016-08-10 13:51:53 -06:00
parent 68e5a3d4dd
commit ec501991a4
5 changed files with 10 additions and 15 deletions

@ -212,7 +212,7 @@ func execCredsCommand(cfg *config.Configuration, input Creds, subCommand string)
}
if _, ok := err.(*exec.ExitError); ok {
if !cfg.GetenvBool("GIT_TERMINAL_PROMPT", true) {
if !cfg.Os.Bool("GIT_TERMINAL_PROMPT", true) {
return nil, fmt.Errorf("Change the GIT_TERMINAL_PROMPT env var to be prompted to enter your credentials for %s://%s.",
input["protocol"], input["host"])
}

@ -64,7 +64,7 @@ func smudgeCommand(cmd *cobra.Command, args []string) {
download := lfs.FilenamePassesIncludeExcludeFilter(filename, cfg.FetchIncludePaths(), cfg.FetchExcludePaths())
if smudgeSkip || cfg.GetenvBool("GIT_LFS_SKIP_SMUDGE", false) {
if smudgeSkip || cfg.Os.Bool("GIT_LFS_SKIP_SMUDGE", false) {
download = false
}

@ -275,14 +275,14 @@ func usage(cmd *cobra.Command) error {
}
// isCommandEnabled returns whether the environment variable GITLFS<CMD>ENABLED
// is "truthy" according to config.GetenvBool (see
// github.com/github/git-lfs/config#Configuration.GetenvBool), returning false
// is "truthy" according to config.Os.Bool (see
// github.com/github/git-lfs/config#Configuration.Env.Os), returning false
// by default if the enviornment variable is not specified.
//
// This function call should only guard commands that do not yet have stable
// APIs or solid server implementations.
func isCommandEnabled(cfg *config.Configuration, cmd string) bool {
return cfg.GetenvBool(fmt.Sprintf("GITLFS%sENABLED", strings.ToUpper(cmd)), false)
return cfg.Os.Bool(fmt.Sprintf("GITLFS%sENABLED", strings.ToUpper(cmd)), false)
}
func init() {

@ -82,9 +82,9 @@ func New() *Configuration {
CurrentRemote: defaultRemote,
envVars: make(map[string]string),
}
c.IsTracingHttp = c.GetenvBool("GIT_CURL_VERBOSE", false)
c.IsDebuggingHttp = c.GetenvBool("LFS_DEBUG_HTTP", false)
c.IsLoggingStats = c.GetenvBool("GIT_LOG_STATS", false)
c.IsTracingHttp = c.Os.Bool("GIT_CURL_VERBOSE", false)
c.IsDebuggingHttp = c.Os.Bool("LFS_DEBUG_HTTP", false)
c.IsLoggingStats = c.Os.Bool("GIT_LOG_STATS", false)
return c
}
@ -208,11 +208,6 @@ func (c *Configuration) Getenv(key string) string {
return v
}
// GetenvBool is shorthand for `c.Os.Bool(key, def)`.
func (c *Configuration) GetenvBool(key string, def bool) bool {
return c.Os.Bool(key, def)
}
// GitRemoteUrl returns the git clone/push url for a given remote (blank if not found)
// the forpush argument is to cater for separate remote.name.pushurl settings
func (c *Configuration) GitRemoteUrl(remote string, forpush bool) string {
@ -465,7 +460,7 @@ func (c *Configuration) FetchPruneConfig() FetchPruneConfig {
}
func (c *Configuration) SkipDownloadErrors() bool {
return c.GetenvBool("GIT_LFS_SKIP_DOWNLOAD_ERRORS", false) || c.GitConfigBool("lfs.skipdownloaderrors", false)
return c.Os.Bool("GIT_LFS_SKIP_DOWNLOAD_ERRORS", false) || c.GitConfigBool("lfs.skipdownloaderrors", false)
}
func (c *Configuration) loadGitConfig() bool {

@ -19,7 +19,7 @@ func isCertVerificationDisabledForHost(cfg *config.Configuration, host string) b
}
globalSslVerify, _ := cfg.GitConfig("http.sslverify")
if globalSslVerify == "false" || cfg.GetenvBool("GIT_SSL_NO_VERIFY", false) {
if globalSslVerify == "false" || cfg.Os.Bool("GIT_SSL_NO_VERIFY", false) {
return true
}