From 52dca5dc0e60d4d84aa5ecf280a45b24f1111dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 15 Mar 2025 15:29:01 +0100 Subject: Checkout referenced repos when preparing job --- src/Repo.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Repo.hs') 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 () -- cgit v1.2.3