@@ -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 ) {
@@ -523,6 +538,10 @@ func NewIndexRefsIter(filters sql.Expression, index sql.IndexLookup) RefsIter {
523
538
func (i * squashRefIndexIter ) Repository () * Repository { return i .repo }
524
539
func (i * squashRefIndexIter ) Ref () * Ref { return i .ref }
525
540
func (i * squashRefIndexIter ) Close () error {
541
+ if i .repo != nil {
542
+ i .repo .Close ()
543
+ }
544
+
526
545
return i .iter .Close ()
527
546
}
528
547
func (i * squashRefIndexIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -778,8 +797,6 @@ func NewRemoteRefsIter(
778
797
func (i * squashRemoteRefsIter ) Repository () * Repository { return i .remotes .Repository () }
779
798
func (i * squashRemoteRefsIter ) Ref () * Ref { return i .ref }
780
799
func (i * squashRemoteRefsIter ) Close () error {
781
- i .Repository ().Close ()
782
-
783
800
if i .refs != nil {
784
801
i .refs .Close ()
785
802
}
@@ -929,7 +946,9 @@ func (i *squashRefRefCommitsIter) Close() error {
929
946
i .refs .Close ()
930
947
}
931
948
932
- i .Repository ().Close ()
949
+ if i .commits != nil {
950
+ i .commits .Close ()
951
+ }
933
952
return nil
934
953
}
935
954
func (i * squashRefRefCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1202,7 +1221,9 @@ func (i *squashRefCommitsIndexIter) Schema() sql.Schema {
1202
1221
return RefCommitsSchema
1203
1222
}
1204
1223
func (i * squashRefCommitsIndexIter ) Close () error {
1205
- i .repo .Close ()
1224
+ if i .repo != nil {
1225
+ i .repo .Close ()
1226
+ }
1206
1227
return i .iter .Close ()
1207
1228
}
1208
1229
@@ -1226,7 +1247,6 @@ func (i *squashRefCommitCommitsIter) Close() error {
1226
1247
i .refCommits .Close ()
1227
1248
}
1228
1249
1229
- i .Repository ().Close ()
1230
1250
return nil
1231
1251
}
1232
1252
func (i * squashRefCommitCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1297,8 +1317,10 @@ func (i *squashCommitsIter) Close() error {
1297
1317
if i .commits != nil {
1298
1318
i .commits .Close ()
1299
1319
}
1320
+ if i .repo != nil {
1321
+ i .repo .Close ()
1322
+ }
1300
1323
1301
- i .repo .Close ()
1302
1324
return nil
1303
1325
}
1304
1326
func (i * squashCommitsIter ) New (ctx * sql.Context , repo * Repository ) (ChainableIter , error ) {
@@ -1472,7 +1494,10 @@ func (i *squashCommitsIndexIter) Schema() sql.Schema {
1472
1494
return CommitsSchema
1473
1495
}
1474
1496
func (i * squashCommitsIndexIter ) Close () error {
1475
- i .repo .Close ()
1497
+ if i .repo != nil {
1498
+ i .repo .Close ()
1499
+ }
1500
+
1476
1501
return i .iter .Close ()
1477
1502
}
1478
1503
@@ -1499,8 +1524,6 @@ func (i *squashRepoCommitsIter) Close() error {
1499
1524
i .commits .Close ()
1500
1525
}
1501
1526
1502
- i .Repository ().Close ()
1503
-
1504
1527
if i .repos != nil {
1505
1528
return i .repos .Close ()
1506
1529
}
@@ -1611,8 +1634,6 @@ func NewRefHEADCommitsIter(
1611
1634
func (i * squashRefHeadCommitsIter ) Repository () * Repository { return i .refs .Repository () }
1612
1635
func (i * squashRefHeadCommitsIter ) Commit () * object.Commit { return i .commit }
1613
1636
func (i * squashRefHeadCommitsIter ) Close () error {
1614
- i .Repository ().Close ()
1615
-
1616
1637
if i .refs != nil {
1617
1638
return i .refs .Close ()
1618
1639
}
@@ -1805,7 +1826,10 @@ func (i *squashCommitTreesIndexIter) Schema() sql.Schema {
1805
1826
return CommitTreesSchema
1806
1827
}
1807
1828
func (i * squashCommitTreesIndexIter ) Close () error {
1808
- i .repo .Close ()
1829
+ if i .repo != nil {
1830
+ i .repo .Close ()
1831
+ }
1832
+
1809
1833
return i .iter .Close ()
1810
1834
}
1811
1835
@@ -1837,6 +1861,9 @@ func NewCommitTreesIter(
1837
1861
func (i * squashCommitTreesIter ) Repository () * Repository { return i .commits .Repository () }
1838
1862
func (i * squashCommitTreesIter ) Tree () * object.Tree { return i .tree }
1839
1863
func (i * squashCommitTreesIter ) Close () error {
1864
+ if i .trees != nil {
1865
+ i .trees .Close ()
1866
+ }
1840
1867
if i .commits != nil {
1841
1868
return i .commits .Close ()
1842
1869
}
@@ -1953,8 +1980,6 @@ func (i *squashRepoTreeEntriesIter) Close() error {
1953
1980
i .trees .Close ()
1954
1981
}
1955
1982
1956
- i .Repository ().Close ()
1957
-
1958
1983
if i .repos != nil {
1959
1984
return i .repos .Close ()
1960
1985
}
@@ -2083,8 +2108,6 @@ func NewCommitMainTreeIter(
2083
2108
func (i * squashCommitMainTreeIter ) Repository () * Repository { return i .commits .Repository () }
2084
2109
func (i * squashCommitMainTreeIter ) Tree () * object.Tree { return i .tree }
2085
2110
func (i * squashCommitMainTreeIter ) Close () error {
2086
- i .Repository ().Close ()
2087
-
2088
2111
if i .commits != nil {
2089
2112
return i .commits .Close ()
2090
2113
}
@@ -2247,6 +2270,12 @@ func (i *commitTreeIter) Next() (*object.Tree, error) {
2247
2270
}
2248
2271
}
2249
2272
2273
+ func (i * commitTreeIter ) Close () {
2274
+ if i .repo != nil {
2275
+ i .repo .Close ()
2276
+ }
2277
+ }
2278
+
2250
2279
// TreeEntriesIter is a chainable iterator that operates on Tree Entries.
2251
2280
type TreeEntriesIter interface {
2252
2281
ChainableIter
@@ -2277,7 +2306,9 @@ func NewAllTreeEntriesIter(filters sql.Expression) TreeEntriesIter {
2277
2306
func (i * squashTreeEntriesIter ) Repository () * Repository { return i .repo }
2278
2307
func (i * squashTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2279
2308
func (i * squashTreeEntriesIter ) Close () error {
2280
- i .Repository ().Close ()
2309
+ if i .repo != nil {
2310
+ i .repo .Close ()
2311
+ }
2281
2312
2282
2313
if i .trees != nil {
2283
2314
i .trees .Close ()
@@ -2448,7 +2479,9 @@ func (i *squashTreeEntriesIndexIter) Schema() sql.Schema {
2448
2479
return TreeEntriesSchema
2449
2480
}
2450
2481
func (i * squashTreeEntriesIndexIter ) Close () error {
2451
- i .Repository ().Close ()
2482
+ if i .repo != nil {
2483
+ i .repo .Close ()
2484
+ }
2452
2485
return i .iter .Close ()
2453
2486
}
2454
2487
@@ -2480,8 +2513,6 @@ func NewTreeTreeEntriesIter(
2480
2513
func (i * squashTreeTreeEntriesIter ) Repository () * Repository { return i .trees .Repository () }
2481
2514
func (i * squashTreeTreeEntriesIter ) TreeEntry () * TreeEntry { return i .entry }
2482
2515
func (i * squashTreeTreeEntriesIter ) Close () error {
2483
- i .Repository ().Close ()
2484
-
2485
2516
if i .trees != nil {
2486
2517
return i .trees .Close ()
2487
2518
}
@@ -2651,7 +2682,9 @@ func (i *squashCommitBlobsIndexIter) Schema() sql.Schema {
2651
2682
return CommitBlobsSchema
2652
2683
}
2653
2684
func (i * squashCommitBlobsIndexIter ) Close () error {
2654
- i .Repository ().Close ()
2685
+ if i .repo != nil {
2686
+ i .repo .Close ()
2687
+ }
2655
2688
return i .iter .Close ()
2656
2689
}
2657
2690
@@ -2689,8 +2722,6 @@ func (i *squashCommitBlobsIter) Close() error {
2689
2722
i .files .Close ()
2690
2723
}
2691
2724
2692
- i .Repository ().Close ()
2693
-
2694
2725
if i .commits != nil {
2695
2726
return i .commits .Close ()
2696
2727
}
@@ -2821,8 +2852,6 @@ func (i *squashRepoBlobsIter) Close() error {
2821
2852
i .blobs .Close ()
2822
2853
}
2823
2854
2824
- i .Repository ().Close ()
2825
-
2826
2855
if i .repos != nil {
2827
2856
return i .repos .Close ()
2828
2857
}
@@ -3207,7 +3236,6 @@ func (i *squashCommitFilesIter) Close() error {
3207
3236
i .files .Close ()
3208
3237
}
3209
3238
3210
- i .Repository ().Close ()
3211
3239
return i .commits .Close ()
3212
3240
}
3213
3241
func (i * squashCommitFilesIter ) Schema () sql.Schema {
@@ -3315,7 +3343,9 @@ func (i *squashIndexCommitFilesIter) Row() sql.Row { return i.row }
3315
3343
func (i * squashIndexCommitFilesIter ) Schema () sql.Schema { return CommitFilesSchema }
3316
3344
3317
3345
func (i * squashIndexCommitFilesIter ) Close () error {
3318
- i .repo .Close ()
3346
+ if i .repo != nil {
3347
+ i .repo .Close ()
3348
+ }
3319
3349
return i .iter .Close ()
3320
3350
}
3321
3351
@@ -3391,7 +3421,6 @@ func (i *squashCommitFileFilesIter) Schema() sql.Schema {
3391
3421
return append (i .files .Schema (), FilesSchema ... )
3392
3422
}
3393
3423
func (i * squashCommitFileFilesIter ) Close () error {
3394
- i .Repository ().Close ()
3395
3424
return i .files .Close ()
3396
3425
}
3397
3426
0 commit comments