MCPcopy Index your code
hub / github.com/go-git/go-git / TestForcePushDeleteReference

Method TestForcePushDeleteReference

remote_test.go:802–827  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

800}
801
802func (s *RemoteSuite) TestForcePushDeleteReference(c *C) {
803 fs := fixtures.Basic().One().DotGit()
804 sto := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
805
806 url := c.MkDir()
807
808 r, err := PlainClone(url, true, &CloneOptions{
809 URL: fs.Root(),
810 })
811 c.Assert(err, IsNil)
812
813 remote, err := r.Remote(DefaultRemoteName)
814 c.Assert(err, IsNil)
815
816 err = remote.Push(&PushOptions{
817 RefSpecs: []config.RefSpec{":refs/heads/branch"},
818 Force: true,
819 })
820 c.Assert(err, IsNil)
821
822 _, err = sto.Reference(plumbing.ReferenceName("refs/heads/branch"))
823 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
824
825 _, err = r.Storer.Reference(plumbing.ReferenceName("refs/heads/branch"))
826 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
827}
828
829func (s *RemoteSuite) TestPushRejectNonFastForward(c *C) {
830 fs := fixtures.Basic().One().DotGit()

Callers

nothing calls this directly

Calls 8

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
ReferenceNameTypeAlias · 0.92
PlainCloneFunction · 0.85
RootMethod · 0.80
RemoteMethod · 0.80
PushMethod · 0.65
ReferenceMethod · 0.65

Tested by

no test coverage detected