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

Method TestLogFileNext

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

Source from the content-addressed store, hash-verified

2000}
2001
2002func (s *RepositorySuite) TestLogFileNext(c *C) {
2003 r, _ := Init(memory.NewStorage(), nil)
2004 err := r.clone(context.Background(), &CloneOptions{
2005 URL: s.GetBasicLocalRepositoryURL(),
2006 })
2007
2008 c.Assert(err, IsNil)
2009
2010 fileName := "vendor/foo.go"
2011 cIter, err := r.Log(&LogOptions{FileName: &fileName})
2012
2013 c.Assert(err, IsNil)
2014
2015 commitOrder := []plumbing.Hash{
2016 plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
2017 }
2018
2019 for _, o := range commitOrder {
2020 commit, err := cIter.Next()
2021 c.Assert(err, IsNil)
2022 c.Assert(commit.Hash, Equals, o)
2023 }
2024 _, err = cIter.Next()
2025 c.Assert(err, Equals, io.EOF)
2026}
2027
2028func (s *RepositorySuite) TestLogFileForEach(c *C) {
2029 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