diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-09-04 12:22:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 12:22:01 +0200 |
commit | 63d92533b538cb380667deee5dc6d32f0946c737 (patch) | |
tree | 6603b432d724b822da25938a1d00369a460518d6 /repository_test.go | |
parent | 6da5e5958ecc0e6f8da6ee2b6714e50b8ef26df4 (diff) | |
parent | 70b98de4945f1b6bd0f92be049a36b90a0c23282 (diff) | |
download | go-git-63d92533b538cb380667deee5dc6d32f0946c737.tar.gz |
Merge pull request #161 from ashokponkumar/master
PlainOpenWithOptions: support file path
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go index 6a6ab9e..7d4ddce 100644 --- a/repository_test.go +++ b/repository_test.go @@ -569,6 +569,11 @@ func (s *RepositorySuite) TestPlainOpenDetectDotGit(c *C) { err = os.MkdirAll(subdir, 0755) c.Assert(err, IsNil) + file := filepath.Join(subdir, "file.txt") + f, err := os.Create(file) + c.Assert(err, IsNil) + f.Close() + r, err := PlainInit(dir, false) c.Assert(err, IsNil) c.Assert(r, NotNil) @@ -577,6 +582,15 @@ func (s *RepositorySuite) TestPlainOpenDetectDotGit(c *C) { r, err = PlainOpenWithOptions(subdir, opt) c.Assert(err, IsNil) c.Assert(r, NotNil) + + 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) { |