aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-11-08 23:46:38 +0100
committerGitHub <noreply@github.com>2016-11-08 23:46:38 +0100
commitac095bb12c4d29722b60ba9f20590fa7cfa6bc7d (patch)
tree223f36f336ba3414b1e45cac8af6c4744a5d7ef6 /repository_test.go
parente523701393598f4fa241dd407af9ff8925507a1a (diff)
downloadgo-git-ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d.tar.gz
new plumbing package (#118)
* plumbing: now core was renamed to core, and formats and clients moved inside
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go70
1 files changed, 35 insertions, 35 deletions
diff --git a/repository_test.go b/repository_test.go
index 6c7fe4f..dbcc232 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -2,7 +2,7 @@ package git
import (
"gopkg.in/src-d/go-git.v4/config"
- "gopkg.in/src-d/go-git.v4/core"
+ "gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/storage/memory"
. "gopkg.in/check.v1"
@@ -64,7 +64,7 @@ func (s *RepositorySuite) TestClone(c *C) {
r := NewMemoryRepository()
head, err := r.Head()
- c.Assert(err, Equals, core.ErrReferenceNotFound)
+ c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
err = r.Clone(&CloneOptions{
@@ -77,10 +77,10 @@ func (s *RepositorySuite) TestClone(c *C) {
c.Assert(err, IsNil)
c.Assert(remotes, HasLen, 1)
- head, err = r.Ref(core.HEAD, false)
+ head, err = r.Ref(plumbing.HEAD, false)
c.Assert(err, IsNil)
c.Assert(head, NotNil)
- c.Assert(head.Type(), Equals, core.SymbolicReference)
+ c.Assert(head.Type(), Equals, plumbing.SymbolicReference)
c.Assert(head.Target().String(), Equals, "refs/heads/master")
branch, err := r.Ref(head.Target(), false)
@@ -91,13 +91,13 @@ func (s *RepositorySuite) TestClone(c *C) {
branch, err = r.Ref("refs/remotes/origin/master", false)
c.Assert(err, IsNil)
c.Assert(branch, NotNil)
- c.Assert(branch.Type(), Equals, core.HashReference)
+ c.Assert(branch.Type(), Equals, plumbing.HashReference)
c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
branch, err = r.Ref("refs/remotes/origin/branch", false)
c.Assert(err, IsNil)
c.Assert(branch, NotNil)
- c.Assert(branch.Type(), Equals, core.HashReference)
+ c.Assert(branch.Type(), Equals, plumbing.HashReference)
c.Assert(branch.Hash().String(), Equals, "e8d3ffab552895c19b9fcf7aa264d277cde33881")
}
@@ -105,7 +105,7 @@ func (s *RepositorySuite) TestCloneNonEmpty(c *C) {
r := NewMemoryRepository()
head, err := r.Head()
- c.Assert(err, Equals, core.ErrReferenceNotFound)
+ c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
o := &CloneOptions{URL: RepositoryFixture}
@@ -120,12 +120,12 @@ func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) {
r := NewMemoryRepository()
head, err := r.Head()
- c.Assert(err, Equals, core.ErrReferenceNotFound)
+ c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
err = r.Clone(&CloneOptions{
URL: RepositoryFixture,
- ReferenceName: core.ReferenceName("refs/heads/branch"),
+ ReferenceName: plumbing.ReferenceName("refs/heads/branch"),
SingleBranch: true,
})
@@ -135,10 +135,10 @@ func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) {
c.Assert(err, IsNil)
c.Assert(remotes, HasLen, 1)
- head, err = r.Ref(core.HEAD, false)
+ head, err = r.Ref(plumbing.HEAD, false)
c.Assert(err, IsNil)
c.Assert(head, NotNil)
- c.Assert(head.Type(), Equals, core.SymbolicReference)
+ c.Assert(head.Type(), Equals, plumbing.SymbolicReference)
c.Assert(head.Target().String(), Equals, "refs/heads/branch")
branch, err := r.Ref(head.Target(), false)
@@ -149,7 +149,7 @@ func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) {
branch, err = r.Ref("refs/remotes/origin/branch", false)
c.Assert(err, IsNil)
c.Assert(branch, NotNil)
- c.Assert(branch.Type(), Equals, core.HashReference)
+ c.Assert(branch.Type(), Equals, plumbing.HashReference)
c.Assert(branch.Hash().String(), Equals, "e8d3ffab552895c19b9fcf7aa264d277cde33881")
}
@@ -157,7 +157,7 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) {
r := NewMemoryRepository()
head, err := r.Head()
- c.Assert(err, Equals, core.ErrReferenceNotFound)
+ c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
err = r.Clone(&CloneOptions{
@@ -171,10 +171,10 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) {
c.Assert(err, IsNil)
c.Assert(remotes, HasLen, 1)
- head, err = r.Ref(core.HEAD, false)
+ head, err = r.Ref(plumbing.HEAD, false)
c.Assert(err, IsNil)
c.Assert(head, NotNil)
- c.Assert(head.Type(), Equals, core.SymbolicReference)
+ c.Assert(head.Type(), Equals, plumbing.SymbolicReference)
c.Assert(head.Target().String(), Equals, "refs/heads/master")
branch, err := r.Ref(head.Target(), false)
@@ -185,7 +185,7 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) {
branch, err = r.Ref("refs/remotes/origin/master", false)
c.Assert(err, IsNil)
c.Assert(branch, NotNil)
- c.Assert(branch.Type(), Equals, core.HashReference)
+ c.Assert(branch.Type(), Equals, plumbing.HashReference)
c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
}
@@ -193,13 +193,13 @@ func (s *RepositorySuite) TestCloneDetachedHEAD(c *C) {
r := NewMemoryRepository()
err := r.Clone(&CloneOptions{
URL: RepositoryFixture,
- ReferenceName: core.ReferenceName("refs/tags/v1.0.0"),
+ ReferenceName: plumbing.ReferenceName("refs/tags/v1.0.0"),
})
- head, err := r.Ref(core.HEAD, false)
+ head, err := r.Ref(plumbing.HEAD, false)
c.Assert(err, IsNil)
c.Assert(head, NotNil)
- c.Assert(head.Type(), Equals, core.HashReference)
+ c.Assert(head.Type(), Equals, plumbing.HashReference)
c.Assert(head.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
}
@@ -259,14 +259,14 @@ func (s *RepositorySuite) TestCommit(c *C) {
c.Assert(err, IsNil)
- hash := core.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47")
+ hash := plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47")
commit, err := r.Commit(hash)
c.Assert(err, IsNil)
c.Assert(commit.Hash.IsZero(), Equals, false)
c.Assert(commit.Hash, Equals, commit.ID())
c.Assert(commit.Hash, Equals, hash)
- c.Assert(commit.Type(), Equals, core.CommitObject)
+ c.Assert(commit.Type(), Equals, plumbing.CommitObject)
tree, err := commit.Tree()
c.Assert(err, IsNil)
@@ -292,7 +292,7 @@ func (s *RepositorySuite) TestCommits(c *C) {
count++
c.Assert(commit.Hash.IsZero(), Equals, false)
c.Assert(commit.Hash, Equals, commit.ID())
- c.Assert(commit.Type(), Equals, core.CommitObject)
+ c.Assert(commit.Type(), Equals, plumbing.CommitObject)
}
c.Assert(count, Equals, 9)
@@ -303,13 +303,13 @@ func (s *RepositorySuite) TestTag(c *C) {
err := r.Clone(&CloneOptions{URL: "https://github.com/spinnaker/spinnaker.git"})
c.Assert(err, IsNil)
- hash := core.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
+ hash := plumbing.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
tag, err := r.Tag(hash)
c.Assert(err, IsNil)
c.Assert(tag.Hash.IsZero(), Equals, false)
c.Assert(tag.Hash, Equals, hash)
- c.Assert(tag.Type(), Equals, core.TagObject)
+ c.Assert(tag.Type(), Equals, plumbing.TagObject)
}
func (s *RepositorySuite) TestTags(c *C) {
@@ -324,13 +324,13 @@ func (s *RepositorySuite) TestTags(c *C) {
tags.ForEach(func(tag *Tag) error {
count++
c.Assert(tag.Hash.IsZero(), Equals, false)
- c.Assert(tag.Type(), Equals, core.TagObject)
+ c.Assert(tag.Type(), Equals, plumbing.TagObject)
return nil
})
refs, _ := r.Refs()
- refs.ForEach(func(ref *core.Reference) error {
+ refs.ForEach(func(ref *plumbing.Reference) error {
return nil
})
@@ -352,13 +352,13 @@ func (s *RepositorySuite) TestRef(c *C) {
err := r.Clone(&CloneOptions{URL: RepositoryFixture})
c.Assert(err, IsNil)
- ref, err := r.Ref(core.HEAD, false)
+ ref, err := r.Ref(plumbing.HEAD, false)
c.Assert(err, IsNil)
- c.Assert(ref.Name(), Equals, core.HEAD)
+ c.Assert(ref.Name(), Equals, plumbing.HEAD)
- ref, err = r.Ref(core.HEAD, true)
+ ref, err = r.Ref(plumbing.HEAD, true)
c.Assert(err, IsNil)
- c.Assert(ref.Name(), Equals, core.ReferenceName("refs/heads/master"))
+ c.Assert(ref.Name(), Equals, plumbing.ReferenceName("refs/heads/master"))
}
func (s *RepositorySuite) TestRefs(c *C) {
@@ -378,13 +378,13 @@ func (s *RepositorySuite) TestObject(c *C) {
err := r.Clone(&CloneOptions{URL: "https://github.com/spinnaker/spinnaker.git"})
c.Assert(err, IsNil)
- hash := core.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
+ hash := plumbing.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
tag, err := r.Tag(hash)
c.Assert(err, IsNil)
c.Assert(tag.Hash.IsZero(), Equals, false)
c.Assert(tag.Hash, Equals, hash)
- c.Assert(tag.Type(), Equals, core.TagObject)
+ c.Assert(tag.Type(), Equals, plumbing.TagObject)
}
func (s *RepositorySuite) TestObjectNotFound(c *C) {
@@ -392,8 +392,8 @@ func (s *RepositorySuite) TestObjectNotFound(c *C) {
err := r.Clone(&CloneOptions{URL: "https://github.com/git-fixtures/basic.git"})
c.Assert(err, IsNil)
- hash := core.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
- tag, err := r.Object(core.TagObject, hash)
- c.Assert(err, DeepEquals, core.ErrObjectNotFound)
+ hash := plumbing.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
+ tag, err := r.Object(plumbing.TagObject, hash)
+ c.Assert(err, DeepEquals, plumbing.ErrObjectNotFound)
c.Assert(tag, IsNil)
}