aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/core/export.go17
-rw-r--r--bridge/core/import.go18
-rw-r--r--repository/config_git.go6
3 files changed, 36 insertions, 5 deletions
diff --git a/bridge/core/export.go b/bridge/core/export.go
index 0f45404c..4397a527 100644
--- a/bridge/core/export.go
+++ b/bridge/core/export.go
@@ -29,6 +29,10 @@ const (
// Error happened during export
ExportEventError
+
+ // Something wrong happened during export that is worth notifying to the user
+ // but not severe enough to consider the export a failure.
+ ExportEventWarning
)
// ExportResult is an event that is emitted during the export process, to
@@ -65,6 +69,11 @@ func (er ExportResult) String() string {
return fmt.Sprintf("export error at %s: %s", er.ID, er.Err.Error())
}
return fmt.Sprintf("export error: %s", er.Err.Error())
+ case ExportEventWarning:
+ if er.ID != "" {
+ return fmt.Sprintf("warning at %s: %s", er.ID, er.Err.Error())
+ }
+ return fmt.Sprintf("warning: %s", er.Err.Error())
default:
panic("unknown export result")
@@ -79,6 +88,14 @@ func NewExportError(err error, id entity.Id) ExportResult {
}
}
+func NewExportWarning(err error, id entity.Id) ExportResult {
+ return ExportResult{
+ ID: id,
+ Err: err,
+ Event: ExportEventWarning,
+ }
+}
+
func NewExportNothing(id entity.Id, reason string) ExportResult {
return ExportResult{
ID: id,
diff --git a/bridge/core/import.go b/bridge/core/import.go
index e4771d2c..5f138da7 100644
--- a/bridge/core/import.go
+++ b/bridge/core/import.go
@@ -31,6 +31,10 @@ const (
// Error happened during import
ImportEventError
+
+ // Something wrong happened during import that is worth notifying to the user
+ // but not severe enough to consider the import a failure.
+ ImportEventWarning
)
// ImportResult is an event that is emitted during the import process, to
@@ -69,6 +73,12 @@ func (er ImportResult) String() string {
return fmt.Sprintf("import error at id %s: %s", er.ID, er.Err.Error())
}
return fmt.Sprintf("import error: %s", er.Err.Error())
+ case ImportEventWarning:
+ if er.ID != "" {
+ return fmt.Sprintf("warning at id %s: %s", er.ID, er.Err.Error())
+ }
+ return fmt.Sprintf("warning: %s", er.Err.Error())
+
default:
panic("unknown import result")
}
@@ -82,6 +92,14 @@ func NewImportError(err error, id entity.Id) ImportResult {
}
}
+func NewImportWarning(err error, id entity.Id) ImportResult {
+ return ImportResult{
+ Err: err,
+ ID: id,
+ Event: ImportEventWarning,
+ }
+}
+
func NewImportNothing(id entity.Id, reason string) ImportResult {
return ImportResult{
ID: id,
diff --git a/repository/config_git.go b/repository/config_git.go
index cff82afb..c4d222cf 100644
--- a/repository/config_git.go
+++ b/repository/config_git.go
@@ -66,11 +66,7 @@ func (gc *gitConfig) ReadAll(keyPrefix string) (map[string]string, error) {
continue
}
- parts := strings.Fields(line)
- if len(parts) != 2 {
- return nil, fmt.Errorf("bad git config: %s", line)
- }
-
+ parts := strings.SplitN(line, " ", 2)
result[parts[0]] = parts[1]
}