aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorAshok Pon Kumar <ashokponkumar@gmail.com>2020-09-02 00:01:12 +0530
committerAshok Pon Kumar <ashokponkumar@gmail.com>2020-09-02 00:01:12 +0530
commite7be6a4e2442826f9a54f2d40e9658552972c644 (patch)
treea26312ac281bec5760d33064cc940609c1961e09 /repository.go
parent6da5e5958ecc0e6f8da6ee2b6714e50b8ef26df4 (diff)
downloadgo-git-e7be6a4e2442826f9a54f2d40e9658552972c644.tar.gz
support file path in PlainOpenWithOptions
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/repository.go b/repository.go
index 9dd35be..d954333 100644
--- a/repository.go
+++ b/repository.go
@@ -278,6 +278,14 @@ func dotGitToOSFilesystems(path string, detect bool) (dot, wt billy.Filesystem,
if path, err = filepath.Abs(path); err != nil {
return nil, nil, err
}
+
+ pathinfo, err := os.Stat(path)
+ if !os.IsNotExist(err) {
+ if !pathinfo.IsDir() {
+ path = filepath.Dir(path)
+ }
+ }
+
var fs billy.Filesystem
var fi os.FileInfo
for {