MCPcopy
hub / github.com/go-git/go-git / TestLog

Method TestLog

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

Source from the content-addressed store, hash-verified

1761}
1762
1763func (s *RepositorySuite) TestLog(c *C) {
1764 r, _ := Init(memory.NewStorage(), nil)
1765 err := r.clone(context.Background(), &CloneOptions{
1766 URL: s.GetBasicLocalRepositoryURL(),
1767 })
1768
1769 c.Assert(err, IsNil)
1770
1771 cIter, err := r.Log(&LogOptions{
1772 From: plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
1773 })
1774
1775 c.Assert(err, IsNil)
1776
1777 commitOrder := []plumbing.Hash{
1778 plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
1779 plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
1780 }
1781
1782 for _, o := range commitOrder {
1783 commit, err := cIter.Next()
1784 c.Assert(err, IsNil)
1785 c.Assert(commit.Hash, Equals, o)
1786 }
1787 _, err = cIter.Next()
1788 c.Assert(err, Equals, io.EOF)
1789}
1790
1791func (s *RepositorySuite) TestLogAll(c *C) {
1792 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 7

NewStorageFunction · 0.92
NewHashFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
LogMethod · 0.80
NextMethod · 0.65

Tested by

no test coverage detected