diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-07-01 22:46:07 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-07-02 18:28:52 +0200 |
commit | 518998bebf22b6bb92dd246026fce62ad57a0b0b (patch) | |
tree | b18554b1d4f8799c05dd3d524759439685b9fc9e /src/Repo.hs | |
parent | ac70a5f9aebcfd51901740681463d1ac4fa90e33 (diff) |
Automatically run dependencies
Changelog: Automatically run dependencies of jobs specified on command line
Diffstat (limited to 'src/Repo.hs')
-rw-r--r-- | src/Repo.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Repo.hs b/src/Repo.hs index b154209..09e577b 100644 --- a/src/Repo.hs +++ b/src/Repo.hs @@ -9,8 +9,8 @@ module Repo ( Tag(..), openRepo, - readCommit, tryReadCommit, - readTree, tryReadTree, + readCommit, readCommitId, tryReadCommit, + readTree, readTreeId, tryReadTree, readBranch, readTag, listCommits, @@ -175,6 +175,9 @@ readCommit :: (MonadIO m, MonadFail m) => Repo -> Text -> m Commit readCommit repo@GitRepo {..} ref = maybe (fail err) return =<< tryReadCommit repo ref where err = "revision ‘" <> T.unpack ref <> "’ not found in ‘" <> gitDir <> "’" +readCommitId :: (MonadIO m, MonadFail m) => Repo -> CommitId -> m Commit +readCommitId repo cid = readCommit repo (textCommitId cid) + tryReadCommit :: (MonadIO m, MonadFail m) => Repo -> Text -> m (Maybe Commit) tryReadCommit repo ref = sequence . fmap (mkCommit repo . CommitId) =<< tryReadObjectId repo "commit" ref @@ -182,6 +185,9 @@ readTree :: (MonadIO m, MonadFail m) => Repo -> FilePath -> Text -> m Tree readTree repo@GitRepo {..} subdir ref = maybe (fail err) return =<< tryReadTree repo subdir ref where err = "tree ‘" <> T.unpack ref <> "’ not found in ‘" <> gitDir <> "’" +readTreeId :: (MonadIO m, MonadFail m) => Repo -> FilePath -> TreeId -> m Tree +readTreeId repo subdir tid = readTree repo subdir $ textTreeId tid + tryReadTree :: (MonadIO m, MonadFail m) => Repo -> FilePath -> Text -> m (Maybe Tree) tryReadTree treeRepo treeSubdir ref = do fmap (fmap TreeId) (tryReadObjectId treeRepo "tree" ref) >>= \case |