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, 8 insertions, 0 deletions
diff --git a/plumbing/format/gitignore/dir.go b/plumbing/format/gitignore/dir.go
index bb78655..bf6a1c1 100644
--- a/plumbing/format/gitignore/dir.go
+++ b/plumbing/format/gitignore/dir.go
@@ -25,6 +25,14 @@ const (
// readIgnoreFile reads a specific git ignore file.
func readIgnoreFile(fs billy.Filesystem, path []string, ignoreFile string) (ps []Pattern, err error) {
+
+ if strings.HasPrefix(ignoreFile, "~") {
+ home, err := os.UserHomeDir()
+ if err == nil {
+ ignoreFile = strings.Replace(ignoreFile, "~", home, 1)
+ }
+ }
+
f, err := fs.Open(fs.Join(append(path, ignoreFile)...))
if err == nil {
defer f.Close()