aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/bridge.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-15 15:39:49 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-15 15:46:36 +0100
commite231b6e83956635e5e4923c064cab19e6730150a (patch)
treea0740cc0b8b82fac54e9e863e76f7a7ad85cd672 /bridge/core/bridge.go
parent02548c0e8f96a5c08efe46bd5f71f97fdd211de3 (diff)
downloadgit-bug-e231b6e83956635e5e4923c064cab19e6730150a.tar.gz
bridges: pass the context to Init for when a client build process needs it
Diffstat (limited to 'bridge/core/bridge.go')
-rw-r--r--bridge/core/bridge.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go
index c72ff6b4..10f6b109 100644
--- a/bridge/core/bridge.go
+++ b/bridge/core/bridge.go
@@ -299,14 +299,14 @@ func (b *Bridge) getExporter() Exporter {
return b.exporter
}
-func (b *Bridge) ensureImportInit() error {
+func (b *Bridge) ensureImportInit(ctx context.Context) error {
if b.initImportDone {
return nil
}
importer := b.getImporter()
if importer != nil {
- err := importer.Init(b.repo, b.conf)
+ err := importer.Init(ctx, b.repo, b.conf)
if err != nil {
return err
}
@@ -316,22 +316,14 @@ func (b *Bridge) ensureImportInit() error {
return nil
}
-func (b *Bridge) ensureExportInit() error {
+func (b *Bridge) ensureExportInit(ctx context.Context) error {
if b.initExportDone {
return nil
}
- importer := b.getImporter()
- if importer != nil {
- err := importer.Init(b.repo, b.conf)
- if err != nil {
- return err
- }
- }
-
exporter := b.getExporter()
if exporter != nil {
- err := exporter.Init(b.repo, b.conf)
+ err := exporter.Init(ctx, b.repo, b.conf)
if err != nil {
return err
}
@@ -355,7 +347,7 @@ func (b *Bridge) ImportAllSince(ctx context.Context, since time.Time) (<-chan Im
return nil, err
}
- err = b.ensureImportInit()
+ err = b.ensureImportInit(ctx)
if err != nil {
return nil, err
}
@@ -409,7 +401,7 @@ func (b *Bridge) ExportAll(ctx context.Context, since time.Time) (<-chan ExportR
return nil, err
}
- err = b.ensureExportInit()
+ err = b.ensureExportInit(ctx)
if err != nil {
return nil, err
}