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

Method TestFetch

repository_test.go:1239–1260  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

1237}
1238
1239func (s *RepositorySuite) TestFetch(c *C) {
1240 r, _ := Init(memory.NewStorage(), nil)
1241 _, err := r.CreateRemote(&config.RemoteConfig{
1242 Name: DefaultRemoteName,
1243 URLs: []string{s.GetBasicLocalRepositoryURL()},
1244 })
1245 c.Assert(err, IsNil)
1246 c.Assert(r.Fetch(&FetchOptions{}), IsNil)
1247
1248 remotes, err := r.Remotes()
1249 c.Assert(err, IsNil)
1250 c.Assert(remotes, HasLen, 1)
1251
1252 _, err = r.Head()
1253 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
1254
1255 branch, err := r.Reference("refs/remotes/origin/master", false)
1256 c.Assert(err, IsNil)
1257 c.Assert(branch, NotNil)
1258 c.Assert(branch.Type(), Equals, plumbing.HashReference)
1259 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
1260}
1261
1262func (s *RepositorySuite) TestFetchContext(c *C) {
1263 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 11

NewStorageFunction · 0.92
InitFunction · 0.85
CreateRemoteMethod · 0.80
RemotesMethod · 0.80
HeadMethod · 0.80
ReferenceMethod · 0.65
TypeMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65
FetchMethod · 0.45

Tested by

no test coverage detected