MCPcopy Create free account
hub / github.com/go-git/go-git / TestFetch

Method TestFetch

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

Source from the content-addressed store, hash-verified

1265}
1266
1267func (s *RepositorySuite) TestFetch(c *C) {
1268 r, _ := Init(memory.NewStorage(), nil)
1269 _, err := r.CreateRemote(&config.RemoteConfig{
1270 Name: DefaultRemoteName,
1271 URLs: []string{s.GetBasicLocalRepositoryURL()},
1272 })
1273 c.Assert(err, IsNil)
1274 c.Assert(r.Fetch(&FetchOptions{}), IsNil)
1275
1276 remotes, err := r.Remotes()
1277 c.Assert(err, IsNil)
1278 c.Assert(remotes, HasLen, 1)
1279
1280 _, err = r.Head()
1281 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
1282
1283 branch, err := r.Reference("refs/remotes/origin/master", false)
1284 c.Assert(err, IsNil)
1285 c.Assert(branch, NotNil)
1286 c.Assert(branch.Type(), Equals, plumbing.HashReference)
1287 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
1288}
1289
1290func (s *RepositorySuite) TestFetchContext(c *C) {
1291 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