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

Method TestLogFileInitialCommit

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

Source from the content-addressed store, hash-verified

2085}
2086
2087func (s *RepositorySuite) TestLogFileInitialCommit(c *C) {
2088 r, _ := Init(memory.NewStorage(), nil)
2089 err := r.clone(context.Background(), &CloneOptions{
2090 URL: s.GetBasicLocalRepositoryURL(),
2091 })
2092 c.Assert(err, IsNil)
2093
2094 fileName := "LICENSE"
2095 cIter, err := r.Log(&LogOptions{
2096 Order: LogOrderCommitterTime,
2097 FileName: &fileName,
2098 })
2099 c.Assert(err, IsNil)
2100 defer cIter.Close()
2101
2102 commitOrder := []plumbing.Hash{
2103 plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
2104 }
2105
2106 expectedIndex := 0
2107 err = cIter.ForEach(func(commit *object.Commit) error {
2108 expectedCommitHash := commitOrder[expectedIndex]
2109 c.Assert(commit.Hash.String(), Equals, expectedCommitHash.String())
2110 expectedIndex++
2111 return nil
2112 })
2113 c.Assert(err, IsNil)
2114 c.Assert(expectedIndex, Equals, 1)
2115}
2116
2117func (s *RepositorySuite) TestLogFileWithOtherParamsFail(c *C) {
2118 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected