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

Method Next

plumbing/object/commit_walker_ctime.go:51–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51func (w *commitIteratorByCTime) Next() (*Commit, error) {
52 var c *Commit
53 for {
54 cIn, ok := w.heap.Pop()
55 if !ok {
56 return nil, io.EOF
57 }
58 c = cIn.(*Commit)
59
60 if w.seen[c.Hash] || w.seenExternal[c.Hash] {
61 continue
62 }
63
64 w.seen[c.Hash] = true
65
66 for _, h := range c.ParentHashes {
67 if w.seen[h] || w.seenExternal[h] {
68 continue
69 }
70 pc, err := GetCommit(c.s, h)
71 if err != nil {
72 return nil, err
73 }
74 w.heap.Push(pc)
75 }
76
77 return c, nil
78 }
79}
80
81func (w *commitIteratorByCTime) ForEach(cb func(*Commit) error) error {
82 for {

Callers 1

ForEachMethod · 0.95

Calls 3

GetCommitFunction · 0.85
PopMethod · 0.65
PushMethod · 0.65

Tested by

no test coverage detected