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

Method TestLogAll

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

Source from the content-addressed store, hash-verified

1789}
1790
1791func (s *RepositorySuite) TestLogAll(c *C) {
1792 r, _ := Init(memory.NewStorage(), nil)
1793 err := r.clone(context.Background(), &CloneOptions{
1794 URL: s.GetBasicLocalRepositoryURL(),
1795 })
1796 c.Assert(err, IsNil)
1797
1798 rIter, err := r.Storer.IterReferences()
1799 c.Assert(err, IsNil)
1800
1801 refCount := 0
1802 err = rIter.ForEach(func(ref *plumbing.Reference) error {
1803 refCount++
1804 return nil
1805 })
1806 c.Assert(err, IsNil)
1807 c.Assert(refCount, Equals, 5)
1808
1809 cIter, err := r.Log(&LogOptions{
1810 All: true,
1811 })
1812 c.Assert(err, IsNil)
1813
1814 commitOrder := []plumbing.Hash{
1815 plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
1816 plumbing.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881"),
1817 plumbing.NewHash("918c48b83bd081e863dbe1b80f8998f058cd8294"),
1818 plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a"),
1819 plumbing.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea"),
1820 plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"),
1821 plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
1822 plumbing.NewHash("a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69"),
1823 plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
1824 }
1825
1826 for _, o := range commitOrder {
1827 commit, err := cIter.Next()
1828 c.Assert(err, IsNil)
1829 c.Assert(commit.Hash, Equals, o)
1830 }
1831 _, err = cIter.Next()
1832 c.Assert(err, Equals, io.EOF)
1833 cIter.Close()
1834}
1835
1836func (s *RepositorySuite) TestLogAllMissingReferences(c *C) {
1837 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected