summaryrefslogtreecommitdiffstats
path: root/pkg/commands/config.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-10-23 09:52:19 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-10-23 10:26:47 +1100
commitb6a5e9d615f0fee7d76f5db33ff48bf32f0ef98b (patch)
tree32644c7c8810c2217cb26d750e5eafee7e07760f /pkg/commands/config.go
parent5011cac7ea2b1d8ce9d9976b59c17f579c270fd9 (diff)
use cached git config
Diffstat (limited to 'pkg/commands/config.go')
-rw-r--r--pkg/commands/config.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/pkg/commands/config.go b/pkg/commands/config.go
index 9600c3403..922e4f580 100644
--- a/pkg/commands/config.go
+++ b/pkg/commands/config.go
@@ -15,12 +15,8 @@ func (c *GitCommand) ConfiguredPager() string {
if os.Getenv("PAGER") != "" {
return os.Getenv("PAGER")
}
- output, err := c.RunCommandWithOutput("git config --get-all core.pager")
- if err != nil {
- return ""
- }
- trimmedOutput := strings.TrimSpace(output)
- return strings.Split(trimmedOutput, "\n")[0]
+ output := c.GitConfig.Get("core.pager")
+ return strings.Split(output, "\n")[0]
}
func (c *GitCommand) GetPager(width int) string {
@@ -42,11 +38,6 @@ func (c *GitCommand) colorArg() string {
return c.Config.GetUserConfig().Git.Paging.ColorArg
}
-func (c *GitCommand) GetConfigValue(key string) string {
- output, _ := c.getGitConfigValue(key)
- return output
-}
-
// UsingGpg tells us whether the user has gpg enabled so that we can know
// whether we need to run a subprocess to allow them to enter their password
func (c *GitCommand) UsingGpg() bool {
@@ -55,8 +46,5 @@ func (c *GitCommand) UsingGpg() bool {
return false
}
- gpgsign := c.GetConfigValue("commit.gpgsign")
- value := strings.ToLower(gpgsign)
-
- return value == "true" || value == "1" || value == "yes" || value == "on"
+ return c.GitConfig.GetBool("commit.gpgsign")
}