only show the warning for 'git lfs env'

This commit is contained in:
risk danger olson 2015-11-16 13:13:47 -07:00
parent 3ce5770cba
commit 265feee819
2 changed files with 9 additions and 5 deletions

@ -14,6 +14,7 @@ var (
) )
func envCommand(cmd *cobra.Command, args []string) { func envCommand(cmd *cobra.Command, args []string) {
lfs.ShowConfigWarnings = true
config := lfs.Config config := lfs.Config
endpoint := config.Endpoint() endpoint := config.Endpoint()

@ -16,8 +16,9 @@ import (
) )
var ( var (
Config = NewConfig() Config = NewConfig()
defaultRemote = "origin" defaultRemote = "origin"
ShowConfigWarnings = false
) )
// FetchPruneConfig collects together the config options that control fetching and pruning // FetchPruneConfig collects together the config options that control fetching and pruning
@ -370,9 +371,11 @@ func (c *Configuration) readGitConfigFromFiles(filenames []string, filenameIndex
if os.IsNotExist(err) { if os.IsNotExist(err) {
newIndex := filenameIndex + 1 newIndex := filenameIndex + 1
if len(filenames) > newIndex { if len(filenames) > newIndex {
expected := ".lfsconfig" if ShowConfigWarnings {
fmt.Fprintf(os.Stderr, "WARNING: Reading LFS config from %q, not %q. Rename to %q before Git LFS v2.0 to remove this warning.\n", expected := ".lfsconfig"
filepath.Base(filenames[newIndex]), expected, expected) fmt.Fprintf(os.Stderr, "WARNING: Reading LFS config from %q, not %q. Rename to %q before Git LFS v2.0 to remove this warning.\n",
filepath.Base(filenames[newIndex]), expected, expected)
}
c.readGitConfigFromFiles(filenames, newIndex, uniqRemotes) c.readGitConfigFromFiles(filenames, newIndex, uniqRemotes)
} }
return return