aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-05-21 12:31:46 +0200
committerGitHub <noreply@github.com>2020-05-21 12:31:46 +0200
commit6d8103df45ce09ffd5323b4ef46d26440400a54f (patch)
tree300780aa8d799bef9ac7c85618e514f07bb72516 /remote_test.go
parent838eb2979f6085fc0e5bc8856e7f1944a455a970 (diff)
parentb5b511a94e28ea0346fc83a2afec43e5514fdb1e (diff)
downloadgo-git-6d8103df45ce09ffd5323b4ef46d26440400a54f.tar.gz
Merge pull request #71 from kappyhappy/master
Remote.Push: support force option
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 0fc3449..ce46390 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -612,6 +612,34 @@ func (s *RemoteSuite) TestPushForce(c *C) {
c.Assert(newRef, Not(DeepEquals), oldRef)
}
+func (s *RemoteSuite) TestPushForceWithOption(c *C) {
+ f := fixtures.Basic().One()
+ sto := filesystem.NewStorage(f.DotGit(), cache.NewObjectLRUDefault())
+
+ dstFs := f.DotGit()
+ dstSto := filesystem.NewStorage(dstFs, cache.NewObjectLRUDefault())
+
+ url := dstFs.Root()
+ r := NewRemote(sto, &config.RemoteConfig{
+ Name: DefaultRemoteName,
+ URLs: []string{url},
+ })
+
+ oldRef, err := dstSto.Reference(plumbing.ReferenceName("refs/heads/branch"))
+ c.Assert(err, IsNil)
+ c.Assert(oldRef, NotNil)
+
+ err = r.Push(&PushOptions{
+ RefSpecs: []config.RefSpec{"refs/heads/master:refs/heads/branch"},
+ Force: true,
+ })
+ c.Assert(err, IsNil)
+
+ newRef, err := dstSto.Reference(plumbing.ReferenceName("refs/heads/branch"))
+ c.Assert(err, IsNil)
+ c.Assert(newRef, Not(DeepEquals), oldRef)
+}
+
func (s *RemoteSuite) TestPushPrune(c *C) {
fs := fixtures.Basic().One().DotGit()
url := c.MkDir()