Skip to content

Commit

Permalink
Source description from right path
Browse files Browse the repository at this point in the history
  • Loading branch information
m-col committed Sep 24, 2021
1 parent 7af0c2f commit 57468a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions description
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a placeholder respository description used for testing!
8 changes: 3 additions & 5 deletions src/Repositories.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ processRepo templates config path = withRepository lgFactory path $
-- This is split out to make type reasoning a bit easier.
processRepo' :: [Template] -> Config -> FilePath -> ReaderT LgRepo IO ()
processRepo' templates config path = do
liftIO $ createDirectoryIfMissing True outPath
let name = takeFileName path
liftIO $ createDirectoryIfMissing True $ outputDirectory config </> name
resolveReference "HEAD" >>= \case
Nothing -> liftIO . print $ "gitserve: " <> name <> ": Failed to resolve HEAD."
Just commitID -> do
Expand All @@ -62,7 +63,7 @@ processRepo' templates config path = do

-- description: The description of the repository from repo/description, if
-- it exists.
description <- liftIO $ getDescription $ outPath </> "description"
description <- liftIO $ getDescription $ path </> "description"

-- commits: A list of `Git.Commit` objects to HEAD.
commits <- getCommits gitHead
Expand All @@ -74,9 +75,6 @@ processRepo' templates config path = do
let repo = package config name description commits tree
liftIO . mapM (generate repo) $ templates
return ()
where
name = takeFileName path
outPath = outputDirectory config </> name

{-
The role of the function above is to gather information about a git repository and
Expand Down

0 comments on commit 57468a3

Please sign in to comment.