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

Method TestCloneConfig

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

Source from the content-addressed store, hash-verified

1327}
1328
1329func (s *RepositorySuite) TestCloneConfig(c *C) {
1330 r, _ := Init(memory.NewStorage(), nil)
1331
1332 head, err := r.Head()
1333 c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
1334 c.Assert(head, IsNil)
1335
1336 err = r.clone(context.Background(), &CloneOptions{
1337 URL: s.GetBasicLocalRepositoryURL(),
1338 })
1339
1340 c.Assert(err, IsNil)
1341
1342 cfg, err := r.Config()
1343 c.Assert(err, IsNil)
1344
1345 c.Assert(cfg.Core.IsBare, Equals, true)
1346 c.Assert(cfg.Remotes, HasLen, 1)
1347 c.Assert(cfg.Remotes["origin"].Name, Equals, "origin")
1348 c.Assert(cfg.Remotes["origin"].URLs, HasLen, 1)
1349 c.Assert(cfg.Branches, HasLen, 1)
1350 c.Assert(cfg.Branches["master"].Name, Equals, "master")
1351}
1352
1353func (s *RepositorySuite) TestCloneSingleBranchAndNonHEAD(c *C) {
1354 s.testCloneSingleBranchAndNonHEADReference(c, "refs/heads/branch")

Callers

nothing calls this directly

Calls 6

NewStorageFunction · 0.92
InitFunction · 0.85
HeadMethod · 0.80
cloneMethod · 0.80
ConfigMethod · 0.65

Tested by

no test coverage detected