1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

standardise how we read from the config

This commit is contained in:
Jesse Duffield
2020-11-25 08:52:00 +11:00
parent 7513bfb13a
commit 999e170f1d
8 changed files with 240 additions and 234 deletions

View File

@ -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
}