aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 43276c2..ece052a 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -2,6 +2,7 @@ package git
import (
"bytes"
+ "context"
"io"
"io/ioutil"
"os"
@@ -98,6 +99,23 @@ func (s *RemoteSuite) TestFetch(c *C) {
})
}
+func (s *RemoteSuite) TestFetchContext(c *C) {
+ r := newRemote(memory.NewStorage(), &config.RemoteConfig{
+ URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()),
+ })
+
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+
+ err := r.FetchContext(ctx, &FetchOptions{
+ RefSpecs: []config.RefSpec{
+ config.RefSpec("+refs/heads/master:refs/remotes/origin/master"),
+ },
+ })
+ c.Assert(err, NotNil)
+
+}
+
func (s *RemoteSuite) TestFetchWithAllTags(c *C) {
r := newRemote(memory.NewStorage(), &config.RemoteConfig{
URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()),
@@ -340,6 +358,29 @@ func (s *RemoteSuite) TestPushToEmptyRepository(c *C) {
}
+func (s *RemoteSuite) TestPushContext(c *C) {
+ url := c.MkDir()
+ _, err := PlainInit(url, true)
+ c.Assert(err, IsNil)
+
+ fs := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One().DotGit()
+ sto, err := filesystem.NewStorage(fs)
+ c.Assert(err, IsNil)
+
+ r := newRemote(sto, &config.RemoteConfig{
+ Name: DefaultRemoteName,
+ URL: url,
+ })
+
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+
+ err = r.PushContext(ctx, &PushOptions{
+ RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"},
+ })
+ c.Assert(err, NotNil)
+}
+
func (s *RemoteSuite) TestPushTags(c *C) {
url := c.MkDir()
server, err := PlainInit(url, true)