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

Method TestPushNewReferenceAndDeleteInBatch

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

Source from the content-addressed store, hash-verified

1137}
1138
1139func (s *RemoteSuite) TestPushNewReferenceAndDeleteInBatch(c *C) {
1140 fs := fixtures.Basic().One().DotGit()
1141
1142 url := c.MkDir()
1143
1144 server, err := PlainClone(url, true, &CloneOptions{
1145 URL: fs.Root(),
1146 })
1147 c.Assert(err, IsNil)
1148
1149 dir := c.MkDir()
1150
1151 r, err := PlainClone(dir, true, &CloneOptions{
1152 URL: url,
1153 })
1154 c.Assert(err, IsNil)
1155
1156 remote, err := r.Remote(DefaultRemoteName)
1157 c.Assert(err, IsNil)
1158
1159 ref, err := r.Reference(plumbing.ReferenceName("refs/heads/master"), true)
1160 c.Assert(err, IsNil)
1161
1162 err = remote.Push(&PushOptions{RefSpecs: []config.RefSpec{
1163 "refs/heads/master:refs/heads/branch2",
1164 ":refs/heads/branch",
1165 }})
1166 c.Assert(err, IsNil)
1167
1168 AssertReferences(c, server, map[string]string{
1169 "refs/heads/branch2": ref.Hash().String(),
1170 })
1171
1172 AssertReferences(c, r, map[string]string{
1173 "refs/remotes/origin/branch2": ref.Hash().String(),
1174 })
1175
1176 _, err = server.Storer.Reference(plumbing.ReferenceName("refs/heads/branch"))
1177 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
1178}
1179
1180func (s *RemoteSuite) TestPushInvalidEndpoint(c *C) {
1181 r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://\\"}})

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