@@ -782,6 +782,8 @@ func NewRemoteRefsIter(
782
782
func (i * squashRemoteRefsIter ) Repository () * Repository { return i .remotes .Repository () }
783
783
func (i * squashRemoteRefsIter ) Ref () * Ref { return i .ref }
784
784
func (i * squashRemoteRefsIter ) Close () error {
785
+ i .Repository ().Close ()
786
+
785
787
if i .refs != nil {
786
788
i .refs .Close ()
787
789
}
@@ -934,6 +936,8 @@ func (i *squashRefRefCommitsIter) Close() error {
934
936
if i .refs != nil {
935
937
i .refs .Close ()
936
938
}
939
+
940
+ i .Repository ().Close ()
937
941
return nil
938
942
}
939
943
func (i * squashRefRefCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1165,6 +1169,8 @@ func (i *squashRefCommitsIndexIter) Advance() error {
1165
1169
1166
1170
repoID := i .row [0 ]
1167
1171
if i .repo == nil || repoID != i .repo .ID {
1172
+ i .repo .Close ()
1173
+
1168
1174
i .repo , err = i .pool .GetRepo (i .row [0 ].(string ))
1169
1175
if err != nil {
1170
1176
if i .skipGitErrors {
@@ -1204,6 +1210,7 @@ func (i *squashRefCommitsIndexIter) Schema() sql.Schema {
1204
1210
return RefCommitsSchema
1205
1211
}
1206
1212
func (i * squashRefCommitsIndexIter ) Close () error {
1213
+ i .repo .Close ()
1207
1214
return i .iter .Close ()
1208
1215
}
1209
1216
@@ -1226,6 +1233,8 @@ func (i *squashRefCommitCommitsIter) Close() error {
1226
1233
if i .refCommits != nil {
1227
1234
i .refCommits .Close ()
1228
1235
}
1236
+
1237
+ i .Repository ().Close ()
1229
1238
return nil
1230
1239
}
1231
1240
func (i * squashRefCommitCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1296,6 +1305,8 @@ func (i *squashCommitsIter) Close() error {
1296
1305
if i .commits != nil {
1297
1306
i .commits .Close ()
1298
1307
}
1308
+
1309
+ i .repo .Close ()
1299
1310
return nil
1300
1311
}
1301
1312
func (i * squashCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1432,6 +1443,8 @@ func (i *squashCommitsIndexIter) Advance() error {
1432
1443
}
1433
1444
1434
1445
if i .repo == nil || i .repo .ID != i .iter .repoID {
1446
+ i .repo .Close ()
1447
+
1435
1448
i .repo , err = i .pool .GetRepo (i .iter .repoID )
1436
1449
if err != nil {
1437
1450
if i .skipGitErrors {
@@ -1464,6 +1477,7 @@ func (i *squashCommitsIndexIter) Schema() sql.Schema {
1464
1477
return CommitsSchema
1465
1478
}
1466
1479
func (i * squashCommitsIndexIter ) Close () error {
1480
+ i .repo .Close ()
1467
1481
return i .iter .Close ()
1468
1482
}
1469
1483
@@ -1490,9 +1504,12 @@ func (i *squashRepoCommitsIter) Close() error {
1490
1504
i .commits .Close ()
1491
1505
}
1492
1506
1507
+ i .Repository ().Close ()
1508
+
1493
1509
if i .repos != nil {
1494
1510
return i .repos .Close ()
1495
1511
}
1512
+
1496
1513
return nil
1497
1514
}
1498
1515
func (i * squashRepoCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1517,6 +1534,8 @@ func (i *squashRepoCommitsIter) Row() sql.Row { return i.row }
1517
1534
func (i * squashRepoCommitsIter ) Advance () error {
1518
1535
for {
1519
1536
if i .commits == nil {
1537
+ i .Repository ().Close ()
1538
+
1520
1539
err := i .repos .Advance ()
1521
1540
if err != nil {
1522
1541
return err
@@ -1594,6 +1613,8 @@ func NewRefHEADCommitsIter(
1594
1613
func (i * squashRefHeadCommitsIter ) Repository () * Repository { return i .refs .Repository () }
1595
1614
func (i * squashRefHeadCommitsIter ) Commit () * object.Commit { return i .commit }
1596
1615
func (i * squashRefHeadCommitsIter ) Close () error {
1616
+ i .Repository ().Close ()
1617
+
1597
1618
if i .refs != nil {
1598
1619
return i .refs .Close ()
1599
1620
}
@@ -1786,6 +1807,7 @@ func (i *squashCommitTreesIndexIter) Schema() sql.Schema {
1786
1807
return CommitTreesSchema
1787
1808
}
1788
1809
func (i * squashCommitTreesIndexIter ) Close () error {
1810
+ i .repo .Close ()
1789
1811
return i .iter .Close ()
1790
1812
}
1791
1813
@@ -1933,6 +1955,8 @@ func (i *squashRepoTreeEntriesIter) Close() error {
1933
1955
i .trees .Close ()
1934
1956
}
1935
1957
1958
+ i .Repository ().Close ()
1959
+
1936
1960
if i .repos != nil {
1937
1961
return i .repos .Close ()
1938
1962
}
@@ -1961,6 +1985,8 @@ func (i *squashRepoTreeEntriesIter) Row() sql.Row { return i.row }
1961
1985
func (i * squashRepoTreeEntriesIter ) Advance () error {
1962
1986
for {
1963
1987
if i .trees == nil {
1988
+ i .Repository ().Close ()
1989
+
1964
1990
err := i .repos .Advance ()
1965
1991
if err != nil {
1966
1992
return err
@@ -2059,6 +2085,8 @@ func NewCommitMainTreeIter(
2059
2085
func (i * squashCommitMainTreeIter ) Repository () * Repository { return i .commits .Repository () }
2060
2086
func (i * squashCommitMainTreeIter ) Tree () * object.Tree { return i .tree }
2061
2087
func (i * squashCommitMainTreeIter ) Close () error {
2088
+ i .Repository ().Close ()
2089
+
2062
2090
if i .commits != nil {
2063
2091
return i .commits .Close ()
2064
2092
}
@@ -2251,6 +2279,8 @@ func NewAllTreeEntriesIter(filters sql.Expression) TreeEntriesIter {
2251
2279
func (i * squashTreeEntriesIter ) Repository () * Repository { return i .repo }
2252
2280
func (i * squashTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2253
2281
func (i * squashTreeEntriesIter ) Close () error {
2282
+ i .Repository ().Close ()
2283
+
2254
2284
if i .trees != nil {
2255
2285
i .trees .Close ()
2256
2286
}
@@ -2420,6 +2450,7 @@ func (i *squashTreeEntriesIndexIter) Schema() sql.Schema {
2420
2450
return TreeEntriesSchema
2421
2451
}
2422
2452
func (i * squashTreeEntriesIndexIter ) Close () error {
2453
+ i .Repository ().Close ()
2423
2454
return i .iter .Close ()
2424
2455
}
2425
2456
@@ -2451,6 +2482,8 @@ func NewTreeTreeEntriesIter(
2451
2482
func (i * squashTreeTreeEntriesIter ) Repository () * Repository { return i .trees .Repository () }
2452
2483
func (i * squashTreeTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2453
2484
func (i * squashTreeTreeEntriesIter ) Close () error {
2485
+ i .Repository ().Close ()
2486
+
2454
2487
if i .trees != nil {
2455
2488
return i .trees .Close ()
2456
2489
}
@@ -2620,6 +2653,7 @@ func (i *squashCommitBlobsIndexIter) Schema() sql.Schema {
2620
2653
return CommitBlobsSchema
2621
2654
}
2622
2655
func (i * squashCommitBlobsIndexIter ) Close () error {
2656
+ i .Repository ().Close ()
2623
2657
return i .iter .Close ()
2624
2658
}
2625
2659
@@ -2657,6 +2691,8 @@ func (i *squashCommitBlobsIter) Close() error {
2657
2691
i .files .Close ()
2658
2692
}
2659
2693
2694
+ i .Repository ().Close ()
2695
+
2660
2696
if i .commits != nil {
2661
2697
return i .commits .Close ()
2662
2698
}
@@ -2787,6 +2823,8 @@ func (i *squashRepoBlobsIter) Close() error {
2787
2823
i .blobs .Close ()
2788
2824
}
2789
2825
2826
+ i .Repository ().Close ()
2827
+
2790
2828
if i .repos != nil {
2791
2829
return i .repos .Close ()
2792
2830
}
@@ -2810,6 +2848,8 @@ func (i *squashRepoBlobsIter) Row() sql.Row { return i.row }
2810
2848
func (i * squashRepoBlobsIter ) Advance () error {
2811
2849
for {
2812
2850
if i .blobs == nil {
2851
+ i .repos .Repository ().Close ()
2852
+
2813
2853
err := i .repos .Advance ()
2814
2854
if err != nil {
2815
2855
return err
@@ -3169,6 +3209,7 @@ func (i *squashCommitFilesIter) Close() error {
3169
3209
i .files .Close ()
3170
3210
}
3171
3211
3212
+ i .Repository ().Close ()
3172
3213
return i .commits .Close ()
3173
3214
}
3174
3215
func (i * squashCommitFilesIter ) Schema () sql.Schema {
@@ -3229,6 +3270,8 @@ func (i *squashIndexCommitFilesIter) Advance() error {
3229
3270
i .file = commitFile .File
3230
3271
3231
3272
if i .repo == nil || i .repo .ID != commitFile .Repository {
3273
+ i .repo .Close ()
3274
+
3232
3275
i .repo , err = i .pool .GetRepo (commitFile .Repository )
3233
3276
if err != nil {
3234
3277
if i .skipGitErrors {
@@ -3272,7 +3315,11 @@ func (i *squashIndexCommitFilesIter) File() *object.File { return i.file }
3272
3315
func (i * squashIndexCommitFilesIter ) TreeHash () plumbing.Hash { return i .treeHash }
3273
3316
func (i * squashIndexCommitFilesIter ) Row () sql.Row { return i .row }
3274
3317
func (i * squashIndexCommitFilesIter ) Schema () sql.Schema { return CommitFilesSchema }
3275
- func (i * squashIndexCommitFilesIter ) Close () error { return i .iter .Close () }
3318
+
3319
+ func (i * squashIndexCommitFilesIter ) Close () error {
3320
+ i .repo .Close ()
3321
+ return i .iter .Close ()
3322
+ }
3276
3323
3277
3324
type squashCommitFileFilesIter struct {
3278
3325
files FilesIter
@@ -3345,7 +3392,10 @@ func (i *squashCommitFileFilesIter) Row() sql.Row { return i.row }
3345
3392
func (i * squashCommitFileFilesIter ) Schema () sql.Schema {
3346
3393
return append (i .files .Schema (), FilesSchema ... )
3347
3394
}
3348
- func (i * squashCommitFileFilesIter ) Close () error { return i .files .Close () }
3395
+ func (i * squashCommitFileFilesIter ) Close () error {
3396
+ i .Repository ().Close ()
3397
+ return i .files .Close ()
3398
+ }
3349
3399
3350
3400
func evalFilters (ctx * sql.Context , row sql.Row , filters sql.Expression ) (bool , error ) {
3351
3401
v , err := filters .Eval (ctx , row )
0 commit comments