File tree Expand file tree Collapse file tree 2 files changed +47
-24
lines changed Expand file tree Collapse file tree 2 files changed +47
-24
lines changed Original file line number Diff line number Diff line change @@ -215,45 +215,51 @@ func newCommitIter(
215
215
}, nil
216
216
}
217
217
218
- func (i * commitIter ) loadNextRef () (skip bool , err error ) {
219
- if i .refs == nil {
220
- return false , io .EOF
221
- }
218
+ func (i * commitIter ) loadNextRef () (err error ) {
219
+ for {
220
+ if i .refs == nil {
221
+ return io .EOF
222
+ }
222
223
223
- i .ref , err = i .refs .Next ()
224
- if err != nil {
225
- if err == io .EOF {
226
- return false , io .EOF
224
+ i .ref , err = i .refs .Next ()
225
+ if err != nil {
226
+ if err != io .EOF && i .skipGitErrors {
227
+ continue
228
+ }
229
+
230
+ return err
227
231
}
228
232
229
- if i .skipGitErrors {
230
- return true , nil
233
+ if i .ref .Type () != plumbing .HashReference {
234
+ i .ref = nil
235
+ continue
231
236
}
232
237
233
- return false , err
234
- }
238
+ obj , err := i .repo .Object (plumbing .AnyObject , i .ref .Hash ())
239
+ if err != nil {
240
+ if i .skipGitErrors {
241
+ continue
242
+ }
235
243
236
- if i .ref .Type () != plumbing .HashReference {
237
- i .ref = nil
238
- return true , nil
239
- }
244
+ return err
245
+ }
246
+
247
+ if obj .Type () != plumbing .CommitObject {
248
+ continue
249
+ }
240
250
241
- i .queue = append (i .queue , i .ref .Hash ())
251
+ i .queue = append (i .queue , i .ref .Hash ())
242
252
243
- return false , nil
253
+ return nil
254
+ }
244
255
}
245
256
246
257
func (i * commitIter ) Next () (* object.Commit , error ) {
247
258
for {
248
259
if i .ref == nil {
249
- skip , err := i .loadNextRef ()
250
- if err != nil {
260
+ if err := i .loadNextRef (); err != nil {
251
261
return nil , err
252
262
}
253
-
254
- if skip {
255
- continue
256
- }
257
263
}
258
264
259
265
if len (i .queue ) == 0 {
Original file line number Diff line number Diff line change @@ -329,6 +329,23 @@ func TestIntegration(t *testing.T) {
329
329
{"Ignore List" , int32 (1 )},
330
330
},
331
331
},
332
+ {
333
+ `
334
+ SELECT
335
+ repository_id,
336
+ contributor_count
337
+ FROM (
338
+ SELECT
339
+ repository_id,
340
+ COUNT(DISTINCT commit_author_email) AS contributor_count
341
+ FROM commits
342
+ GROUP BY repository_id
343
+ ) AS q
344
+ ORDER BY contributor_count DESC
345
+ LIMIT 10
346
+ ` ,
347
+ []sql.Row {{"worktree" , int32 (9 )}},
348
+ },
332
349
}
333
350
334
351
runTests := func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments