diff options
-rw-r--r-- | repository.go | 2 | ||||
-rw-r--r-- | repository_test.go | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/repository.go b/repository.go index d954333..36fc1f5 100644 --- a/repository.go +++ b/repository.go @@ -281,7 +281,7 @@ func dotGitToOSFilesystems(path string, detect bool) (dot, wt billy.Filesystem, pathinfo, err := os.Stat(path) if !os.IsNotExist(err) { - if !pathinfo.IsDir() { + if !pathinfo.IsDir() && detect { path = filepath.Dir(path) } } diff --git a/repository_test.go b/repository_test.go index 9433a3c..7d4ddce 100644 --- a/repository_test.go +++ b/repository_test.go @@ -583,10 +583,14 @@ func (s *RepositorySuite) TestPlainOpenDetectDotGit(c *C) { c.Assert(err, IsNil) c.Assert(r, NotNil) - opt = &PlainOpenOptions{DetectDotGit: true} r, err = PlainOpenWithOptions(file, opt) c.Assert(err, IsNil) c.Assert(r, NotNil) + + optnodetect := &PlainOpenOptions{DetectDotGit: false} + r, err = PlainOpenWithOptions(file, optnodetect) + c.Assert(err, NotNil) + c.Assert(r, IsNil) } func (s *RepositorySuite) TestPlainOpenNotExistsDetectDotGit(c *C) { |