aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-29 22:53:24 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-29 22:53:24 +0100
commita052498f23198ad1f2e9ca8f9943d2a48e274c06 (patch)
tree40c80303c860574310830306b00747ad75a7b31b
parentacb1dc80d93f45a055b14903679abca3a6e994f6 (diff)
downloadgo-git-a052498f23198ad1f2e9ca8f9943d2a48e274c06.tar.gz
Repository.Clone made private
-rw-r--r--repository.go8
-rw-r--r--repository_test.go32
-rw-r--r--worktree_test.go2
3 files changed, 20 insertions, 22 deletions
diff --git a/repository.go b/repository.go
index dd6663a..c49042f 100644
--- a/repository.go
+++ b/repository.go
@@ -12,7 +12,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
- billy "srcd.works/go-billy.v1"
+ "srcd.works/go-billy.v1"
osfs "srcd.works/go-billy.v1/os"
)
@@ -101,7 +101,7 @@ func Clone(s Storer, worktree billy.Filesystem, o *CloneOptions) (*Repository, e
return nil, err
}
- return r, r.Clone(o)
+ return r, r.clone(o)
}
// PlainInit create an empty git repository at the given path. isBare defines
@@ -160,7 +160,7 @@ func PlainClone(path string, isBare bool, o *CloneOptions) (*Repository, error)
return nil, err
}
- return r, r.Clone(o)
+ return r, r.clone(o)
}
func newRepository(s Storer, worktree billy.Filesystem) *Repository {
@@ -246,7 +246,7 @@ func (r *Repository) DeleteRemote(name string) error {
}
// Clone clones a remote repository
-func (r *Repository) Clone(o *CloneOptions) error {
+func (r *Repository) clone(o *CloneOptions) error {
if err := o.Validate(); err != nil {
return err
}
diff --git a/repository_test.go b/repository_test.go
index 1c0419a..95cf12f 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -286,7 +286,7 @@ func (s *RepositorySuite) TestCloneDeep(c *C) {
c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
- err = r.Clone(&CloneOptions{
+ err = r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
})
@@ -325,7 +325,7 @@ func (s *RepositorySuite) TestCloneConfig(c *C) {
c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
- err = r.Clone(&CloneOptions{
+ err = r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
})
@@ -347,7 +347,7 @@ func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) {
c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
- err = r.Clone(&CloneOptions{
+ err = r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
ReferenceName: plumbing.ReferenceName("refs/heads/branch"),
SingleBranch: true,
@@ -384,7 +384,7 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) {
c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
c.Assert(head, IsNil)
- err = r.Clone(&CloneOptions{
+ err = r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
SingleBranch: true,
})
@@ -415,7 +415,7 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) {
func (s *RepositorySuite) TestCloneDetachedHEAD(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{
+ err := r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
ReferenceName: plumbing.ReferenceName("refs/tags/v1.0.0"),
})
@@ -473,7 +473,7 @@ func (s *RepositorySuite) TestPullUpdateReferencesIfNeeded(c *C) {
func (s *RepositorySuite) TestPullSingleBranch(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{
+ err := r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
SingleBranch: true,
})
@@ -498,7 +498,7 @@ func (s *RepositorySuite) TestPullAdd(c *C) {
path := fixtures.Basic().One().Worktree().Base()
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{
+ err := r.clone(&CloneOptions{
URL: fmt.Sprintf("file://%s", filepath.Join(path, ".git")),
})
@@ -592,7 +592,7 @@ func (s *RepositorySuite) TestPushNonExistentRemote(c *C) {
func (s *RepositorySuite) TestCommit(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{
+ err := r.clone(&CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
})
@@ -616,7 +616,7 @@ func (s *RepositorySuite) TestCommit(c *C) {
func (s *RepositorySuite) TestCommits(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
count := 0
@@ -643,7 +643,7 @@ func (s *RepositorySuite) TestTag(c *C) {
)
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: url})
+ err := r.clone(&CloneOptions{URL: url})
c.Assert(err, IsNil)
hash := plumbing.NewHash("ad7897c0fb8e7d9a9ba41fa66072cf06095a6cfc")
@@ -661,7 +661,7 @@ func (s *RepositorySuite) TestTags(c *C) {
)
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: url})
+ err := r.clone(&CloneOptions{URL: url})
c.Assert(err, IsNil)
count := 0
@@ -686,7 +686,7 @@ func (s *RepositorySuite) TestTags(c *C) {
func (s *RepositorySuite) TestCommitIterClosePanic(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
commits, err := r.Commits()
@@ -696,7 +696,7 @@ func (s *RepositorySuite) TestCommitIterClosePanic(c *C) {
func (s *RepositorySuite) TestRef(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
ref, err := r.Reference(plumbing.HEAD, false)
@@ -710,7 +710,7 @@ func (s *RepositorySuite) TestRef(c *C) {
func (s *RepositorySuite) TestRefs(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
c.Assert(err, IsNil)
@@ -722,7 +722,7 @@ func (s *RepositorySuite) TestRefs(c *C) {
func (s *RepositorySuite) TestObject(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
hash := plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
@@ -735,7 +735,7 @@ func (s *RepositorySuite) TestObject(c *C) {
func (s *RepositorySuite) TestObjectNotFound(c *C) {
r, _ := Init(memory.NewStorage(), nil)
- err := r.Clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
+ err := r.clone(&CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
c.Assert(err, IsNil)
hash := plumbing.NewHash("0a3fb06ff80156fb153bcdcc58b5e16c2d27625c")
diff --git a/worktree_test.go b/worktree_test.go
index 62b0a03..163df7b 100644
--- a/worktree_test.go
+++ b/worktree_test.go
@@ -1,7 +1,6 @@
package git
import (
- "fmt"
"io/ioutil"
"os"
@@ -133,7 +132,6 @@ func (s *WorktreeSuite) TestStatus(c *C) {
status, err := w.Status()
c.Assert(err, IsNil)
- fmt.Println(status)
c.Assert(status.IsClean(), Equals, true)
}