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

Method TestCommits

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

Source from the content-addressed store, hash-verified

2412}
2413
2414func (s *RepositorySuite) TestCommits(c *C) {
2415 r, _ := Init(memory.NewStorage(), nil)
2416 err := r.clone(context.Background(), &CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
2417 c.Assert(err, IsNil)
2418
2419 count := 0
2420 commits, err := r.CommitObjects()
2421 c.Assert(err, IsNil)
2422 for {
2423 commit, err := commits.Next()
2424 if err != nil {
2425 break
2426 }
2427
2428 count++
2429 c.Assert(commit.Hash.IsZero(), Equals, false)
2430 c.Assert(commit.Hash, Equals, commit.ID())
2431 c.Assert(commit.Type(), Equals, plumbing.CommitObject)
2432 }
2433
2434 c.Assert(count, Equals, 9)
2435}
2436
2437func (s *RepositorySuite) TestBlob(c *C) {
2438 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 9

NewStorageFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
CommitObjectsMethod · 0.80
NextMethod · 0.65
IsZeroMethod · 0.65
IDMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected