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

Method TestLogAllOrderByTime

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

Source from the content-addressed store, hash-verified

1886}
1887
1888func (s *RepositorySuite) TestLogAllOrderByTime(c *C) {
1889 r, _ := Init(memory.NewStorage(), nil)
1890 err := r.clone(context.Background(), &CloneOptions{
1891 URL: s.GetBasicLocalRepositoryURL(),
1892 })
1893
1894 c.Assert(err, IsNil)
1895
1896 cIter, err := r.Log(&LogOptions{
1897 Order: LogOrderCommitterTime,
1898 All: true,
1899 })
1900 c.Assert(err, IsNil)
1901
1902 commitOrder := []plumbing.Hash{
1903 plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
1904 plumbing.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881"),
1905 plumbing.NewHash("918c48b83bd081e863dbe1b80f8998f058cd8294"),
1906 plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a"),
1907 plumbing.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea"),
1908 plumbing.NewHash("a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69"),
1909 plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"),
1910 plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
1911 plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
1912 }
1913
1914 for _, o := range commitOrder {
1915 commit, err := cIter.Next()
1916 c.Assert(err, IsNil)
1917 c.Assert(commit.Hash, Equals, o)
1918 }
1919 _, err = cIter.Next()
1920 c.Assert(err, Equals, io.EOF)
1921 cIter.Close()
1922}
1923
1924func (s *RepositorySuite) TestLogHead(c *C) {
1925 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected