From 999e170f1d17b652dad231f1cbde6ab4bbeae8c7 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 25 Nov 2020 08:52:00 +1100 Subject: standardise how we read from the config --- pkg/commands/config.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pkg/commands/config.go') diff --git a/pkg/commands/config.go b/pkg/commands/config.go index 4e747e32c..12bef33fd 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -43,10 +43,13 @@ func (c *GitCommand) colorArg() string { } func (c *GitCommand) GetConfigValue(key string) string { - output, err := c.OSCommand.RunCommandWithOutput("git config --get %s", key) - if err != nil { - // looks like this returns an error if there is no matching value which we're okay with - return "" + value, _ := c.getLocalGitConfig(key) + // we get an error if the key doesn't exist which we don't care about + + if value != "" { + return value } - return strings.TrimSpace(output) + + value, _ = c.getGlobalGitConfig(key) + return value } -- cgit v1.2.3