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

Method TestLogHead

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

Source from the content-addressed store, hash-verified

1922}
1923
1924func (s *RepositorySuite) TestLogHead(c *C) {
1925 r, _ := Init(memory.NewStorage(), nil)
1926 err := r.clone(context.Background(), &CloneOptions{
1927 URL: s.GetBasicLocalRepositoryURL(),
1928 })
1929
1930 c.Assert(err, IsNil)
1931
1932 cIter, err := r.Log(&LogOptions{})
1933
1934 c.Assert(err, IsNil)
1935
1936 commitOrder := []plumbing.Hash{
1937 plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
1938 plumbing.NewHash("918c48b83bd081e863dbe1b80f8998f058cd8294"),
1939 plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a"),
1940 plumbing.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea"),
1941 plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"),
1942 plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
1943 plumbing.NewHash("a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69"),
1944 plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
1945 }
1946
1947 for _, o := range commitOrder {
1948 commit, err := cIter.Next()
1949 c.Assert(err, IsNil)
1950 c.Assert(commit.Hash, Equals, o)
1951 }
1952 _, err = cIter.Next()
1953 c.Assert(err, Equals, io.EOF)
1954}
1955
1956func (s *RepositorySuite) TestLogError(c *C) {
1957 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