MCPcopy
hub / github.com/go-git/go-git / TestPushForceWithOption

Method TestPushForceWithOption

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

Source from the content-addressed store, hash-verified

883}
884
885func (s *RemoteSuite) TestPushForceWithOption(c *C) {
886 f := fixtures.Basic().One()
887 sto := filesystem.NewStorage(f.DotGit(), cache.NewObjectLRUDefault())
888
889 dstFs := f.DotGit()
890 dstSto := filesystem.NewStorage(dstFs, cache.NewObjectLRUDefault())
891
892 url := dstFs.Root()
893 r := NewRemote(sto, &config.RemoteConfig{
894 Name: DefaultRemoteName,
895 URLs: []string{url},
896 })
897
898 oldRef, err := dstSto.Reference(plumbing.ReferenceName("refs/heads/branch"))
899 c.Assert(err, IsNil)
900 c.Assert(oldRef, NotNil)
901
902 err = r.Push(&PushOptions{
903 RefSpecs: []config.RefSpec{"refs/heads/master:refs/heads/branch"},
904 Force: true,
905 })
906 c.Assert(err, IsNil)
907
908 newRef, err := dstSto.Reference(plumbing.ReferenceName("refs/heads/branch"))
909 c.Assert(err, IsNil)
910 c.Assert(newRef, Not(DeepEquals), oldRef)
911}
912
913func (s *RemoteSuite) TestPushForceWithLease_success(c *C) {
914 testCases := []struct {

Callers

nothing calls this directly

Calls 7

PushMethod · 0.95
NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
ReferenceNameTypeAlias · 0.92
NewRemoteFunction · 0.85
RootMethod · 0.80
ReferenceMethod · 0.65

Tested by

no test coverage detected