diff options
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/repository_test.go b/repository_test.go index d1af7b6..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) { @@ -713,7 +727,7 @@ func (s *RepositorySuite) TestPlainCloneContextNonExistentWithNotEmptyDir(c *C) c.Assert(err, IsNil) dummyFile := filepath.Join(repoDirPath, "dummyFile") - err = ioutil.WriteFile(dummyFile, []byte(fmt.Sprint("dummyContent")), 0644) + err = ioutil.WriteFile(dummyFile, []byte("dummyContent"), 0644) c.Assert(err, IsNil) r, err := PlainCloneContext(ctx, repoDirPath, false, &CloneOptions{ @@ -1875,6 +1889,7 @@ func (s *RepositorySuite) TestConfigScoped(c *C) { err := r.clone(context.Background(), &CloneOptions{ URL: s.GetBasicLocalRepositoryURL(), }) + c.Assert(err, IsNil) cfg, err := r.ConfigScoped(config.LocalScope) c.Assert(err, IsNil) @@ -2641,6 +2656,7 @@ func (s *RepositorySuite) TestResolveRevision(c *C) { "v1.0.0~1": "918c48b83bd081e863dbe1b80f8998f058cd8294", "master~1": "918c48b83bd081e863dbe1b80f8998f058cd8294", "918c48b83bd081e863dbe1b80f8998f058cd8294": "918c48b83bd081e863dbe1b80f8998f058cd8294", + "918c48b": "918c48b83bd081e863dbe1b80f8998f058cd8294", // odd number of hex digits } for rev, hash := range datas { |