diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2021-05-02 23:33:16 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2021-05-02 23:33:16 +0200 |
commit | c69d5331743e49d3672897cf1c552e5e123d4509 (patch) | |
tree | df503db7e8889cef313641b31808fc7404b400e3 /plumbing/format/gitignore/dir.go | |
parent | 67d34902b0c41ee5d6d283f4c5b6c2ad7db123fd (diff) | |
download | go-git-c69d5331743e49d3672897cf1c552e5e123d4509.tar.gz |
plumbing: format, use os.UserHomeDir()
Diffstat (limited to 'plumbing/format/gitignore/dir.go')
-rw-r--r-- | plumbing/format/gitignore/dir.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/plumbing/format/gitignore/dir.go b/plumbing/format/gitignore/dir.go index 922c458..7cea50c 100644 --- a/plumbing/format/gitignore/dir.go +++ b/plumbing/format/gitignore/dir.go @@ -5,7 +5,6 @@ import ( "bytes" "io/ioutil" "os" - "os/user" "strings" "github.com/go-git/go-billy/v5" @@ -116,12 +115,12 @@ func loadPatterns(fs billy.Filesystem, path string) (ps []Pattern, err error) { // // The function assumes fs is rooted at the root filesystem. func LoadGlobalPatterns(fs billy.Filesystem) (ps []Pattern, err error) { - usr, err := user.Current() + home, err := os.UserHomeDir() if err != nil { return } - return loadPatterns(fs, fs.Join(usr.HomeDir, gitconfigFile)) + return loadPatterns(fs, fs.Join(home, gitconfigFile)) } // LoadSystemPatterns loads gitignore patterns from from the gitignore file |