diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-30 16:13:56 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-30 16:13:56 +0100 |
commit | 35378e7db9288e8244f2634a1b47981606731cef (patch) | |
tree | 65936a6a365263c93e4b57c3b67aad6a13489e68 /repository_test.go | |
parent | 45669655f026a31577f938ee70ae613c2e4af184 (diff) | |
parent | a48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff) | |
download | go-git-35378e7db9288e8244f2634a1b47981606731cef.tar.gz |
example: using new constructors
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/repository_test.go b/repository_test.go index 7d44a30..1c43c6e 100644 --- a/repository_test.go +++ b/repository_test.go @@ -129,21 +129,6 @@ func (s *RepositorySuite) TestCreateRemoteAndRemote(c *C) { c.Assert(alt.Config().Name, Equals, "foo") } -func (s *RepositorySuite) TestRemoteWithProgress(c *C) { - buf := bytes.NewBuffer(nil) - - r, _ := Init(memory.NewStorage(), nil) - r.Progress = buf - - remote, err := r.CreateRemote(&config.RemoteConfig{ - Name: "foo", - URL: "http://foo/foo.git", - }) - - c.Assert(err, IsNil) - c.Assert(remote.p, Equals, buf) -} - func (s *RepositorySuite) TestCreateRemoteInvalid(c *C) { r, _ := Init(memory.NewStorage(), nil) remote, err := r.CreateRemote(&config.RemoteConfig{}) @@ -449,6 +434,19 @@ func (s *RepositorySuite) TestPullCheckout(c *C) { c.Assert(fi, HasLen, 8) } +func (s *RepositorySuite) TestCloneWithProgress(c *C) { + fs := memoryfs.New() + + buf := bytes.NewBuffer(nil) + _, err := Clone(memory.NewStorage(), fs, &CloneOptions{ + URL: s.GetBasicLocalRepositoryURL(), + Progress: buf, + }) + + c.Assert(err, IsNil) + c.Assert(buf.Len(), Not(Equals), 0) +} + func (s *RepositorySuite) TestPullUpdateReferencesIfNeeded(c *C) { r, _ := Init(memory.NewStorage(), nil) r.CreateRemote(&config.RemoteConfig{ @@ -500,6 +498,23 @@ func (s *RepositorySuite) TestPullSingleBranch(c *C) { c.Assert(storage.Objects, HasLen, 28) } +func (s *RepositorySuite) TestPullProgress(c *C) { + r, _ := Init(memory.NewStorage(), nil) + + r.CreateRemote(&config.RemoteConfig{ + Name: DefaultRemoteName, + URL: s.GetBasicLocalRepositoryURL(), + }) + + buf := bytes.NewBuffer(nil) + err := r.Pull(&PullOptions{ + Progress: buf, + }) + + c.Assert(err, IsNil) + c.Assert(buf.Len(), Not(Equals), 0) +} + func (s *RepositorySuite) TestPullAdd(c *C) { path := fixtures.Basic().One().Worktree().Base() |