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

Method TestPushNewReference

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

Source from the content-addressed store, hash-verified

1100}
1101
1102func (s *RemoteSuite) TestPushNewReference(c *C) {
1103 fs := fixtures.Basic().One().DotGit()
1104
1105 url := c.MkDir()
1106
1107 server, err := PlainClone(url, true, &CloneOptions{
1108 URL: fs.Root(),
1109 })
1110 c.Assert(err, IsNil)
1111
1112 dir := c.MkDir()
1113
1114 r, err := PlainClone(dir, true, &CloneOptions{
1115 URL: url,
1116 })
1117 c.Assert(err, IsNil)
1118
1119 remote, err := r.Remote(DefaultRemoteName)
1120 c.Assert(err, IsNil)
1121
1122 ref, err := r.Reference(plumbing.ReferenceName("refs/heads/master"), true)
1123 c.Assert(err, IsNil)
1124
1125 err = remote.Push(&PushOptions{RefSpecs: []config.RefSpec{
1126 "refs/heads/master:refs/heads/branch2",
1127 }})
1128 c.Assert(err, IsNil)
1129
1130 AssertReferences(c, server, map[string]string{
1131 "refs/heads/branch2": ref.Hash().String(),
1132 })
1133
1134 AssertReferences(c, r, map[string]string{
1135 "refs/remotes/origin/branch2": ref.Hash().String(),
1136 })
1137}
1138
1139func (s *RemoteSuite) TestPushNewReferenceAndDeleteInBatch(c *C) {
1140 fs := fixtures.Basic().One().DotGit()

Callers

nothing calls this directly

Calls 9

ReferenceNameTypeAlias · 0.92
PlainCloneFunction · 0.85
AssertReferencesFunction · 0.85
RootMethod · 0.80
RemoteMethod · 0.80
ReferenceMethod · 0.65
PushMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65

Tested by

no test coverage detected