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

Method TestLogLimitForEach

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

Source from the content-addressed store, hash-verified

2301}
2302
2303func (s *RepositorySuite) TestLogLimitForEach(c *C) {
2304 r, _ := Init(memory.NewStorage(), nil)
2305 err := r.clone(context.Background(), &CloneOptions{
2306 URL: s.GetBasicLocalRepositoryURL(),
2307 })
2308
2309 c.Assert(err, IsNil)
2310
2311 since := time.Date(2015, 3, 31, 11, 54, 0, 0, time.UTC)
2312 until := time.Date(2015, 4, 1, 0, 0, 0, 0, time.UTC)
2313 cIter, err := r.Log(&LogOptions{Since: &since, Until: &until})
2314 c.Assert(err, IsNil)
2315 defer cIter.Close()
2316
2317 commitOrder := []plumbing.Hash{
2318 plumbing.NewHash("918c48b83bd081e863dbe1b80f8998f058cd8294"),
2319 }
2320
2321 expectedIndex := 0
2322 err = cIter.ForEach(func(commit *object.Commit) error {
2323 expectedCommitHash := commitOrder[expectedIndex]
2324 c.Assert(commit.Hash.String(), Equals, expectedCommitHash.String())
2325 expectedIndex++
2326 return nil
2327 })
2328 c.Assert(err, IsNil)
2329 c.Assert(expectedIndex, Equals, 1)
2330}
2331
2332func (s *RepositorySuite) TestLogAllLimitForEach(c *C) {
2333 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 9

NewStorageFunction · 0.92
NewHashFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
LogMethod · 0.80
CloseMethod · 0.65
ForEachMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected