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

Method TestCloneDeep

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

Source from the content-addressed store, hash-verified

1287}
1288
1289func (s *RepositorySuite) TestCloneDeep(c *C) {
1290 fs := memfs.New()
1291 r, _ := Init(memory.NewStorage(), fs)
1292
1293 head, err := r.Head()
1294 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
1295 c.Assert(head, IsNil)
1296
1297 err = r.clone(context.Background(), &CloneOptions{
1298 URL: s.GetBasicLocalRepositoryURL(),
1299 })
1300
1301 c.Assert(err, IsNil)
1302
1303 remotes, err := r.Remotes()
1304 c.Assert(err, IsNil)
1305 c.Assert(remotes, HasLen, 1)
1306
1307 head, err = r.Reference(plumbing.HEAD, false)
1308 c.Assert(err, IsNil)
1309 c.Assert(head, NotNil)
1310 c.Assert(head.Type(), Equals, plumbing.SymbolicReference)
1311 c.Assert(head.Target().String(), Equals, "refs/heads/master")
1312
1313 branch, err := r.Reference(head.Target(), false)
1314 c.Assert(err, IsNil)
1315 c.Assert(branch, NotNil)
1316 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
1317
1318 branch, err = r.Reference("refs/remotes/origin/master", false)
1319 c.Assert(err, IsNil)
1320 c.Assert(branch, NotNil)
1321 c.Assert(branch.Type(), Equals, plumbing.HashReference)
1322 c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
1323
1324 fi, err := fs.ReadDir("")
1325 c.Assert(err, IsNil)
1326 c.Assert(fi, HasLen, 8)
1327}
1328
1329func (s *RepositorySuite) TestCloneConfig(c *C) {
1330 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 12

NewStorageFunction · 0.92
InitFunction · 0.85
HeadMethod · 0.80
cloneMethod · 0.80
RemotesMethod · 0.80
TargetMethod · 0.80
ReferenceMethod · 0.65
TypeMethod · 0.65
StringMethod · 0.65
HashMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected