diff options
Diffstat (limited to 'Omni/Agent/Worker.hs')
| -rw-r--r-- | Omni/Agent/Worker.hs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs index 59d576f..d201234 100644 --- a/Omni/Agent/Worker.hs +++ b/Omni/Agent/Worker.hs @@ -67,15 +67,21 @@ processTask worker task = do if currentBranch == taskBranch then Log.info ["worker", "resuming branch", taskBranch] else do - -- Determine base branch from dependencies - baseBranch <- findBaseBranch repo task - if baseBranch /= "live" + exists <- Git.branchExists repo taskBranch + if exists then do - Log.info ["worker", "basing", taskBranch, "on", baseBranch] - Git.checkout repo baseBranch - else Log.info ["worker", "basing", taskBranch, "on live"] - - Git.createBranch repo taskBranch + Log.info ["worker", "switching to existing branch", taskBranch] + Git.checkout repo taskBranch + else do + -- Determine base branch from dependencies + baseBranch <- findBaseBranch repo task + if baseBranch /= "live" + then do + Log.info ["worker", "basing", taskBranch, "on", baseBranch] + Git.checkout repo baseBranch + else Log.info ["worker", "basing", taskBranch, "on live"] + + Git.createBranch repo taskBranch -- Run Amp exitCode <- runAmp repo task |
