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

Method TestCommits

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

Source from the content-addressed store, hash-verified

2444}
2445
2446func (s *RepositorySuite) TestCommits(c *C) {
2447 r, _ := Init(memory.NewStorage(), nil)
2448 err := r.clone(context.Background(), &CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
2449 c.Assert(err, IsNil)
2450
2451 count := 0
2452 commits, err := r.CommitObjects()
2453 c.Assert(err, IsNil)
2454 for {
2455 commit, err := commits.Next()
2456 if err != nil {
2457 break
2458 }
2459
2460 count++
2461 c.Assert(commit.Hash.IsZero(), Equals, false)
2462 c.Assert(commit.Hash, Equals, commit.ID())
2463 c.Assert(commit.Type(), Equals, plumbing.CommitObject)
2464 }
2465
2466 c.Assert(count, Equals, 9)
2467}
2468
2469func (s *RepositorySuite) TestBlob(c *C) {
2470 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