@@ -56,7 +56,13 @@ func NewAllReposIter(filters sql.Expression) ReposIter {
56
56
}
57
57
58
58
func (i * squashReposIter ) Repo () * Repository { return i .repo }
59
- func (i * squashReposIter ) Close () error { return nil }
59
+ func (i * squashReposIter ) Close () error {
60
+ if i .repo != nil {
61
+ i .repo .Close ()
62
+ }
63
+
64
+ return nil
65
+ }
60
66
func (i * squashReposIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
61
67
session , err := getSession (ctx )
62
68
if err != nil {
@@ -140,7 +146,13 @@ func NewAllRemotesIter(filters sql.Expression) RemotesIter {
140
146
}
141
147
142
148
func (i * squashRemoteIter ) Remote () * Remote { return i .remote }
143
- func (i * squashRemoteIter ) Close () error { return nil }
149
+ func (i * squashRemoteIter ) Close () error {
150
+ if i .repo != nil {
151
+ i .repo .Close ()
152
+ }
153
+
154
+ return nil
155
+ }
144
156
func (i * squashRemoteIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
145
157
session , err := getSession (ctx )
146
158
if err != nil {
@@ -403,6 +415,9 @@ func (i *squashRefIter) Close() error {
403
415
if i .refs != nil {
404
416
i .refs .Close ()
405
417
}
418
+ if i .repo != nil {
419
+ i .repo .Close ()
420
+ }
406
421
return i .repos .Close ()
407
422
}
408
423
func (i * squashRefIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -532,6 +547,10 @@ func NewIndexRefsIter(filters sql.Expression, index sql.IndexLookup) RefsIter {
532
547
func (i * squashRefIndexIter ) Repository () * Repository { return i .repo }
533
548
func (i * squashRefIndexIter ) Ref () * Ref { return i .ref }
534
549
func (i * squashRefIndexIter ) Close () error {
550
+ if i .repo != nil {
551
+ i .repo .Close ()
552
+ }
553
+
535
554
return i .iter .Close ()
536
555
}
537
556
func (i * squashRefIndexIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -792,8 +811,6 @@ func NewRemoteRefsIter(
792
811
func (i * squashRemoteRefsIter ) Repository () * Repository { return i .remotes .Repository () }
793
812
func (i * squashRemoteRefsIter ) Ref () * Ref { return i .ref }
794
813
func (i * squashRemoteRefsIter ) Close () error {
795
- i .Repository ().Close ()
796
-
797
814
if i .refs != nil {
798
815
i .refs .Close ()
799
816
}
@@ -952,7 +969,9 @@ func (i *squashRefRefCommitsIter) Close() error {
952
969
i .refs .Close ()
953
970
}
954
971
955
- i .Repository ().Close ()
972
+ if i .commits != nil {
973
+ i .commits .Close ()
974
+ }
956
975
return nil
957
976
}
958
977
func (i * squashRefRefCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1225,7 +1244,9 @@ func (i *squashRefCommitsIndexIter) Schema() sql.Schema {
1225
1244
return RefCommitsSchema
1226
1245
}
1227
1246
func (i * squashRefCommitsIndexIter ) Close () error {
1228
- i .repo .Close ()
1247
+ if i .repo != nil {
1248
+ i .repo .Close ()
1249
+ }
1229
1250
return i .iter .Close ()
1230
1251
}
1231
1252
@@ -1249,7 +1270,6 @@ func (i *squashRefCommitCommitsIter) Close() error {
1249
1270
i .refCommits .Close ()
1250
1271
}
1251
1272
1252
- i .Repository ().Close ()
1253
1273
return nil
1254
1274
}
1255
1275
func (i * squashRefCommitCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1320,8 +1340,10 @@ func (i *squashCommitsIter) Close() error {
1320
1340
if i .commits != nil {
1321
1341
i .commits .Close ()
1322
1342
}
1343
+ if i .repo != nil {
1344
+ i .repo .Close ()
1345
+ }
1323
1346
1324
- i .repo .Close ()
1325
1347
return nil
1326
1348
}
1327
1349
func (i * squashCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1495,7 +1517,10 @@ func (i *squashCommitsIndexIter) Schema() sql.Schema {
1495
1517
return CommitsSchema
1496
1518
}
1497
1519
func (i * squashCommitsIndexIter ) Close () error {
1498
- i .repo .Close ()
1520
+ if i .repo != nil {
1521
+ i .repo .Close ()
1522
+ }
1523
+
1499
1524
return i .iter .Close ()
1500
1525
}
1501
1526
@@ -1522,8 +1547,6 @@ func (i *squashRepoCommitsIter) Close() error {
1522
1547
i .commits .Close ()
1523
1548
}
1524
1549
1525
- i .Repository ().Close ()
1526
-
1527
1550
if i .repos != nil {
1528
1551
return i .repos .Close ()
1529
1552
}
@@ -1634,8 +1657,6 @@ func NewRefHEADCommitsIter(
1634
1657
func (i * squashRefHeadCommitsIter ) Repository () * Repository { return i .refs .Repository () }
1635
1658
func (i * squashRefHeadCommitsIter ) Commit () * object.Commit { return i .commit }
1636
1659
func (i * squashRefHeadCommitsIter ) Close () error {
1637
- i .Repository ().Close ()
1638
-
1639
1660
if i .refs != nil {
1640
1661
return i .refs .Close ()
1641
1662
}
@@ -1828,7 +1849,10 @@ func (i *squashCommitTreesIndexIter) Schema() sql.Schema {
1828
1849
return CommitTreesSchema
1829
1850
}
1830
1851
func (i * squashCommitTreesIndexIter ) Close () error {
1831
- i .repo .Close ()
1852
+ if i .repo != nil {
1853
+ i .repo .Close ()
1854
+ }
1855
+
1832
1856
return i .iter .Close ()
1833
1857
}
1834
1858
@@ -1860,6 +1884,9 @@ func NewCommitTreesIter(
1860
1884
func (i * squashCommitTreesIter ) Repository () * Repository { return i .commits .Repository () }
1861
1885
func (i * squashCommitTreesIter ) Tree () * object.Tree { return i .tree }
1862
1886
func (i * squashCommitTreesIter ) Close () error {
1887
+ if i .trees != nil {
1888
+ i .trees .Close ()
1889
+ }
1863
1890
if i .commits != nil {
1864
1891
return i .commits .Close ()
1865
1892
}
@@ -1976,8 +2003,6 @@ func (i *squashRepoTreeEntriesIter) Close() error {
1976
2003
i .trees .Close ()
1977
2004
}
1978
2005
1979
- i .Repository ().Close ()
1980
-
1981
2006
if i .repos != nil {
1982
2007
return i .repos .Close ()
1983
2008
}
@@ -2106,8 +2131,6 @@ func NewCommitMainTreeIter(
2106
2131
func (i * squashCommitMainTreeIter ) Repository () * Repository { return i .commits .Repository () }
2107
2132
func (i * squashCommitMainTreeIter ) Tree () * object.Tree { return i .tree }
2108
2133
func (i * squashCommitMainTreeIter ) Close () error {
2109
- i .Repository ().Close ()
2110
-
2111
2134
if i .commits != nil {
2112
2135
return i .commits .Close ()
2113
2136
}
@@ -2270,6 +2293,12 @@ func (i *commitTreeIter) Next() (*object.Tree, error) {
2270
2293
}
2271
2294
}
2272
2295
2296
+ func (i * commitTreeIter ) Close () {
2297
+ if i .repo != nil {
2298
+ i .repo .Close ()
2299
+ }
2300
+ }
2301
+
2273
2302
// TreeEntriesIter is a chainable iterator that operates on Tree Entries.
2274
2303
type TreeEntriesIter interface {
2275
2304
ChainableIter
@@ -2300,7 +2329,9 @@ func NewAllTreeEntriesIter(filters sql.Expression) TreeEntriesIter {
2300
2329
func (i * squashTreeEntriesIter ) Repository () * Repository { return i .repo }
2301
2330
func (i * squashTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2302
2331
func (i * squashTreeEntriesIter ) Close () error {
2303
- i .Repository ().Close ()
2332
+ if i .repo != nil {
2333
+ i .repo .Close ()
2334
+ }
2304
2335
2305
2336
if i .trees != nil {
2306
2337
i .trees .Close ()
@@ -2471,7 +2502,9 @@ func (i *squashTreeEntriesIndexIter) Schema() sql.Schema {
2471
2502
return TreeEntriesSchema
2472
2503
}
2473
2504
func (i * squashTreeEntriesIndexIter ) Close () error {
2474
- i .Repository ().Close ()
2505
+ if i .repo != nil {
2506
+ i .repo .Close ()
2507
+ }
2475
2508
return i .iter .Close ()
2476
2509
}
2477
2510
@@ -2503,8 +2536,6 @@ func NewTreeTreeEntriesIter(
2503
2536
func (i * squashTreeTreeEntriesIter ) Repository () * Repository { return i .trees .Repository () }
2504
2537
func (i * squashTreeTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2505
2538
func (i * squashTreeTreeEntriesIter ) Close () error {
2506
- i .Repository ().Close ()
2507
-
2508
2539
if i .trees != nil {
2509
2540
return i .trees .Close ()
2510
2541
}
@@ -2674,7 +2705,9 @@ func (i *squashCommitBlobsIndexIter) Schema() sql.Schema {
2674
2705
return CommitBlobsSchema
2675
2706
}
2676
2707
func (i * squashCommitBlobsIndexIter ) Close () error {
2677
- i .Repository ().Close ()
2708
+ if i .repo != nil {
2709
+ i .repo .Close ()
2710
+ }
2678
2711
return i .iter .Close ()
2679
2712
}
2680
2713
@@ -2712,8 +2745,6 @@ func (i *squashCommitBlobsIter) Close() error {
2712
2745
i .files .Close ()
2713
2746
}
2714
2747
2715
- i .Repository ().Close ()
2716
-
2717
2748
if i .commits != nil {
2718
2749
return i .commits .Close ()
2719
2750
}
@@ -2844,8 +2875,6 @@ func (i *squashRepoBlobsIter) Close() error {
2844
2875
i .blobs .Close ()
2845
2876
}
2846
2877
2847
- i .Repository ().Close ()
2848
-
2849
2878
if i .repos != nil {
2850
2879
return i .repos .Close ()
2851
2880
}
@@ -3230,7 +3259,6 @@ func (i *squashCommitFilesIter) Close() error {
3230
3259
i .files .Close ()
3231
3260
}
3232
3261
3233
- i .Repository ().Close ()
3234
3262
return i .commits .Close ()
3235
3263
}
3236
3264
func (i * squashCommitFilesIter ) Schema () sql.Schema {
@@ -3338,7 +3366,9 @@ func (i *squashIndexCommitFilesIter) Row() sql.Row { return i.row }
3338
3366
func (i * squashIndexCommitFilesIter ) Schema () sql.Schema { return CommitFilesSchema }
3339
3367
3340
3368
func (i * squashIndexCommitFilesIter ) Close () error {
3341
- i .repo .Close ()
3369
+ if i .repo != nil {
3370
+ i .repo .Close ()
3371
+ }
3342
3372
return i .iter .Close ()
3343
3373
}
3344
3374
@@ -3414,7 +3444,6 @@ func (i *squashCommitFileFilesIter) Schema() sql.Schema {
3414
3444
return append (i .files .Schema (), FilesSchema ... )
3415
3445
}
3416
3446
func (i * squashCommitFileFilesIter ) Close () error {
3417
- i .Repository ().Close ()
3418
3447
return i .files .Close ()
3419
3448
}
3420
3449
0 commit comments