aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/repository.go b/repository.go
index dd822a5..168303f 100644
--- a/repository.go
+++ b/repository.go
@@ -322,8 +322,16 @@ func PlainOpenWithOptions(path string, o *PlainOpenOptions) (*Repository, error)
}
func dotGitToOSFilesystems(path string, detect bool) (dot, wt billy.Filesystem, err error) {
- if path, err = filepath.Abs(path); err != nil {
- return nil, nil, err
+ if strings.HasPrefix(path, "~/") {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return nil, nil, err
+ }
+ path = filepath.Join(home, path[2:])
+ } else {
+ if path, err = filepath.Abs(path); err != nil {
+ return nil, nil, err
+ }
}
var fs billy.Filesystem