From 665396b6792a11c360c735ac7df650feec611d95 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sat, 11 Dec 2021 20:01:30 +0100 Subject: [PATCH] fix: join path correctly --- pkg/git/read.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/git/read.go b/pkg/git/read.go index 69081322..1d9f7acd 100644 --- a/pkg/git/read.go +++ b/pkg/git/read.go @@ -2,6 +2,7 @@ package git import ( "io/ioutil" + "os" "os/user" "path" "path/filepath" @@ -93,7 +94,13 @@ func parseGitConfig() (*gitConfigPkg.Config, error) { return nil, err } - b, err := ioutil.ReadFile(usr.HomeDir + "/.gitconfig") + globalGitConfig := filepath.Join(usr.HomeDir, ".gitconfig") + if _, err := os.Stat(globalGitConfig); os.IsNotExist(err) { + logrus.Debugf("no %s exists, not reading any global git ignore config", globalGitConfig) + return cfg, nil + } + + b, err := ioutil.ReadFile(globalGitConfig) if err != nil { return nil, err }