MCPcopy Create free account
hub / github.com/go-git/go-git / TestForcePushDeleteReference

Method TestForcePushDeleteReference

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

Source from the content-addressed store, hash-verified

774}
775
776func (s *RemoteSuite) TestForcePushDeleteReference(c *C) {
777 fs := fixtures.Basic().One().DotGit()
778 sto := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
779
780 url, clean := s.TemporalDir()
781 defer clean()
782
783 r, err := PlainClone(url, true, &CloneOptions{
784 URL: fs.Root(),
785 })
786 c.Assert(err, IsNil)
787
788 remote, err := r.Remote(DefaultRemoteName)
789 c.Assert(err, IsNil)
790
791 err = remote.Push(&PushOptions{
792 RefSpecs: []config.RefSpec{":refs/heads/branch"},
793 Force: true,
794 })
795 c.Assert(err, IsNil)
796
797 _, err = sto.Reference(plumbing.ReferenceName("refs/heads/branch"))
798 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
799
800 _, err = r.Storer.Reference(plumbing.ReferenceName("refs/heads/branch"))
801 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
802}
803
804func (s *RemoteSuite) TestPushRejectNonFastForward(c *C) {
805 fs := fixtures.Basic().One().DotGit()

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected