summaryrefslogtreecommitdiff
path: root/src/Eval.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-11-27 21:54:20 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-11-28 22:17:37 +0100
commitff3122f0a82f2c0ba3593282f43c911ac521ca12 (patch)
tree676f0ce79e22e893d6d4219ddba99ab24b85dc86 /src/Eval.hs
parentc11cf4ea1822b280be7873c61c004d23627b0349 (diff)
Do not use checkouts with explicit revision in job ID
Diffstat (limited to 'src/Eval.hs')
-rw-r--r--src/Eval.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Eval.hs b/src/Eval.hs
index 71c9b9f..572dad2 100644
--- a/src/Eval.hs
+++ b/src/Eval.hs
@@ -114,7 +114,10 @@ evalJob revisionOverrides dset decl = do
Just dest -> return $ dpublish { jpDestination = dest }
Nothing -> throwError $ OtherEvalError $ "no url defined for destination ‘" <> textDestinationName (jpDestination dpublish) <> "’"
- let otherRepoIds = map (\( repo, ( subtree, tree )) -> JobIdTree (fst <$> repo) subtree (treeId tree)) otherRepoTrees
+ let otherRepoIds = flip mapMaybe otherRepoTrees $ \case
+ ( repo, ( subtree, tree )) -> do
+ guard $ maybe True (isNothing . snd) repo -- use only checkouts without explicit revision in job id
+ Just $ JobIdTree (fst <$> repo) subtree (treeId tree)
return
( Job
{ jobId = JobId $ reverse $ reverse otherRepoIds ++ JobIdName (jobId decl) : eiCurrentIdRev
@@ -166,9 +169,13 @@ canonicalJobName (r : rs) config mbDefaultRepo = do
Just djob -> do
otherRepos <- collectOtherRepos dset djob
( overrides, rs' ) <- (\f -> foldM f ( [], rs ) otherRepos) $
- \( overrides, crs ) ( mbrepo, path ) -> do
- ( tree, crs' ) <- readTreeFromIdRef crs path =<< evalRepo (fst <$> mbrepo)
- return ( ( fst <$> mbrepo, tree ) : overrides, crs' )
+ \( overrides, crs ) ( mbrepo, path ) -> if
+ | Just ( _, Just _ ) <- mbrepo -> do
+ -- use only checkouts without explicit revision in job id
+ return ( overrides, crs )
+ | otherwise -> do
+ ( tree, crs' ) <- readTreeFromIdRef crs path =<< evalRepo (fst <$> mbrepo)
+ return ( ( fst <$> mbrepo, tree ) : overrides, crs' )
case rs' of
(r' : _) -> throwError $ OtherEvalError $ "unexpected job ref part ‘" <> r' <> "’"
_ -> return ()