Commit f576aedfb4d55304cc7a8d370ff478e1357b4964 Parent: f134648414cc291f78794e65a281d77cb97141f5 Author: mcol <mcol@posteo.net> Date: 2021-09-17 02:04:25 +0100 Committer: mcol <mcol@posteo.net> Committed: 2021-09-17 02:04:25 +0100 Add some docstrings to git functions and set up main flow
src/Repositories.hs Modified
@@ -1,4 +1,4 @@ -{-# Language OverloadedStrings #-} -- Needed for repository paths. +{-# Language OverloadedStrings #-} -- Needed for resolvReference module Repositories ( run @@ -11,14 +11,23 @@ import Config (Config, repoPaths) -getLog :: FilePath -> IO () -getLog path = withRepository lgFactory path $ do +{- +This is the entrypoint that receives the ``Config`` and uses it to map over our +repositories, reading from them and writing out their web pages. +-} +run :: Config -> IO () +run = mconcat . fmap processRepo . repoPaths + +{- +This receives a file path to a single repository and tries to process it. If the +repository doesn't exist or is unreadable in any way we can forget about it and move on +(after informing the user of course). +-} +processRepo :: FilePath -> IO () +processRepo path = withRepository lgFactory path $ do maybeObjID <- resolveReference "HEAD" case maybeObjID of Just commitID -> do headCommit <- lookupCommit (Tagged commitID) liftIO $ print $ commitLog headCommit _ -> liftIO (print "Couldn't resolve HEAD") - -run :: Config -> IO () -run = mconcat . fmap getLog . repoPaths