Merge pull request #861 from github/lfs-config-warnings

only show git config warnings for lfs keys
This commit is contained in:
risk danger olson 2015-12-04 08:22:35 -07:00
commit e467a119b8

@ -16,9 +16,10 @@ import (
) )
var ( var (
Config = NewConfig() Config = NewConfig()
defaultRemote = "origin" ShowConfigWarnings = false
ShowConfigWarnings = false defaultRemote = "origin"
gitConfigWarningPrefix = "lfs."
) )
// FetchPruneConfig collects together the config options that control fetching and pruning // FetchPruneConfig collects together the config options that control fetching and pruning
@ -401,10 +402,12 @@ func (c *Configuration) readGitConfig(output string, uniqRemotes map[string]bool
key := strings.ToLower(pieces[0]) key := strings.ToLower(pieces[0])
value := pieces[1] value := pieces[1]
if origKey, ok := uniqKeys[key]; ok && c.gitConfig[key] != value { if origKey, ok := uniqKeys[key]; ok {
fmt.Fprintf(os.Stderr, "WARNING: These git config values clash:\n") if ShowConfigWarnings && c.gitConfig[key] != value && strings.HasPrefix(key, gitConfigWarningPrefix) {
fmt.Fprintf(os.Stderr, " git config %q = %q\n", origKey, c.gitConfig[key]) fmt.Fprintf(os.Stderr, "WARNING: These git config values clash:\n")
fmt.Fprintf(os.Stderr, " git config %q = %q\n", pieces[0], value) fmt.Fprintf(os.Stderr, " git config %q = %q\n", origKey, c.gitConfig[key])
fmt.Fprintf(os.Stderr, " git config %q = %q\n", pieces[0], value)
}
} else { } else {
uniqKeys[key] = pieces[0] uniqKeys[key] = pieces[0]
} }