From 890938ce3490ead7109f70f7d4015a302292b037 Mon Sep 17 00:00:00 2001 From: guyhardonag Date: Thu, 12 Nov 2020 16:27:24 +0200 Subject: [PATCH] requie export-path flage on export set config command --- export/export.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/export/export.go b/export/export.go index dc74eb0b6e1..d1608c9c07e 100644 --- a/export/export.go +++ b/export/export.go @@ -2,6 +2,7 @@ package export import ( "context" + "errors" "fmt" nanoid "github.com/matoous/go-nanoid" @@ -19,6 +20,8 @@ func getExportID(repo, branch, commitRef string) (string, error) { return fmt.Sprintf("%s-%s-%s-%s", repo, branch, commitRef, nid), nil } +var ErrExportInProgress = errors.New("export currently in progress") + // ExportBranchStart inserts a start task on branch, sets branch export state to pending. // It returns an error if an export is already in progress. func ExportBranchStart(paradeDB parade.Parade, cataloger catalog.Cataloger, repo, branch string) (string, error) { @@ -36,6 +39,9 @@ func ExportBranchStart(paradeDB parade.Parade, cataloger catalog.Cataloger, repo if err != nil { return "", nil, err } + if state == catalog.ExportStatusInProgress { + return state, nil, ErrExportInProgress + } tasks, err := GetStartTasks(repo, branch, oldRef, commitRef, exportID, config) if err != nil { return "", nil, err