(c *C)
| 2117 | } |
| 2118 | |
| 2119 | func (s *RepositorySuite) TestLogFileInitialCommit(c *C) { |
| 2120 | r, _ := Init(memory.NewStorage(), nil) |
| 2121 | err := r.clone(context.Background(), &CloneOptions{ |
| 2122 | URL: s.GetBasicLocalRepositoryURL(), |
| 2123 | }) |
| 2124 | c.Assert(err, IsNil) |
| 2125 | |
| 2126 | fileName := "LICENSE" |
| 2127 | cIter, err := r.Log(&LogOptions{ |
| 2128 | Order: LogOrderCommitterTime, |
| 2129 | FileName: &fileName, |
| 2130 | }) |
| 2131 | c.Assert(err, IsNil) |
| 2132 | defer cIter.Close() |
| 2133 | |
| 2134 | commitOrder := []plumbing.Hash{ |
| 2135 | plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"), |
| 2136 | } |
| 2137 | |
| 2138 | expectedIndex := 0 |
| 2139 | err = cIter.ForEach(func(commit *object.Commit) error { |
| 2140 | expectedCommitHash := commitOrder[expectedIndex] |
| 2141 | c.Assert(commit.Hash.String(), Equals, expectedCommitHash.String()) |
| 2142 | expectedIndex++ |
| 2143 | return nil |
| 2144 | }) |
| 2145 | c.Assert(err, IsNil) |
| 2146 | c.Assert(expectedIndex, Equals, 1) |
| 2147 | } |
| 2148 | |
| 2149 | func (s *RepositorySuite) TestLogFileWithOtherParamsFail(c *C) { |
| 2150 | r, _ := Init(memory.NewStorage(), nil) |
nothing calls this directly
no test coverage detected