aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/gitignore/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format/gitignore/dir.go')
-rw-r--r--plumbing/format/gitignore/dir.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/plumbing/format/gitignore/dir.go b/plumbing/format/gitignore/dir.go
index 15bc9c7..d8fb30c 100644
--- a/plumbing/format/gitignore/dir.go
+++ b/plumbing/format/gitignore/dir.go
@@ -3,11 +3,12 @@ package gitignore
import (
"bufio"
"bytes"
- "io/ioutil"
+ "io"
"os"
"strings"
"github.com/go-git/go-billy/v5"
+ "github.com/go-git/go-git/v5/internal/path_util"
"github.com/go-git/go-git/v5/plumbing/format/config"
gioutil "github.com/go-git/go-git/v5/utils/ioutil"
)
@@ -25,6 +26,9 @@ const (
// readIgnoreFile reads a specific git ignore file.
func readIgnoreFile(fs billy.Filesystem, path []string, ignoreFile string) (ps []Pattern, err error) {
+
+ ignoreFile, _ = path_util.ReplaceTildeWithHome(ignoreFile)
+
f, err := fs.Open(fs.Join(append(path, ignoreFile)...))
if err == nil {
defer f.Close()
@@ -86,7 +90,7 @@ func loadPatterns(fs billy.Filesystem, path string) (ps []Pattern, err error) {
defer gioutil.CheckClose(f, &err)
- b, err := ioutil.ReadAll(f)
+ b, err := io.ReadAll(f)
if err != nil {
return
}