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

Method TestPushRejectNonFastForward

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

Source from the content-addressed store, hash-verified

827}
828
829func (s *RemoteSuite) TestPushRejectNonFastForward(c *C) {
830 fs := fixtures.Basic().One().DotGit()
831 server := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
832
833 url := c.MkDir()
834
835 r, err := PlainClone(url, true, &CloneOptions{
836 URL: fs.Root(),
837 })
838 c.Assert(err, IsNil)
839
840 remote, err := r.Remote(DefaultRemoteName)
841 c.Assert(err, IsNil)
842
843 branch := plumbing.ReferenceName("refs/heads/branch")
844 oldRef, err := server.Reference(branch)
845 c.Assert(err, IsNil)
846 c.Assert(oldRef, NotNil)
847
848 err = remote.Push(&PushOptions{RefSpecs: []config.RefSpec{
849 "refs/heads/master:refs/heads/branch",
850 }})
851 c.Assert(err, ErrorMatches, "non-fast-forward update: refs/heads/branch")
852
853 newRef, err := server.Reference(branch)
854 c.Assert(err, IsNil)
855 c.Assert(newRef, DeepEquals, oldRef)
856}
857
858func (s *RemoteSuite) TestPushForce(c *C) {
859 f := fixtures.Basic().One()

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
ReferenceMethod · 0.65
PushMethod · 0.65

Tested by

no test coverage detected