summaryrefslogtreecommitdiff
path: root/src/Repo.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-03-15 15:29:01 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-03-16 20:48:12 +0100
commit52dca5dc0e60d4d84aa5ecf280a45b24f1111dda (patch)
treeeb1e010819ff3a241f9c53db07bb10b1f5a9ccf3 /src/Repo.hs
parent3bb1c548e2696abd3f7dc2d7b9fbc27ceb490c36 (diff)
Checkout referenced repos when preparing job
Diffstat (limited to 'src/Repo.hs')
-rw-r--r--src/Repo.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Repo.hs b/src/Repo.hs
index 2568fff..702f09d 100644
--- a/src/Repo.hs
+++ b/src/Repo.hs
@@ -250,17 +250,17 @@ getCommitMessage :: (MonadIO m, MonadFail m) => Commit -> m Text
getCommitMessage = fmap commitMessage . getCommitDetails
-getSubtree :: MonadIO m => FilePath -> Tree -> m (Maybe Tree)
-getSubtree path tree = liftIO $ do
+getSubtree :: (MonadIO m, MonadFail m) => Maybe Commit -> FilePath -> Tree -> m Tree
+getSubtree mbCommit path tree = liftIO $ do
let GitRepo {..} = treeRepo tree
readProcessWithExitCode "git" [ "--git-dir=" <> gitDir, "rev-parse", "--verify", "--quiet", showTreeId (treeId tree) <> ":" <> path ] "" >>= \case
( ExitSuccess, out, _ ) | tid : _ <- lines out -> do
- return $ Just Tree
+ return Tree
{ treeRepo = treeRepo tree
, treeId = TreeId (BC.pack tid)
}
_ -> do
- return Nothing
+ fail $ "subtree `" <> path <> "' not found" <> maybe "" (("in revision `" <>) . (<> "'") . showCommitId . commitId) mbCommit
checkoutAt :: (MonadIO m, MonadFail m) => Tree -> FilePath -> m ()