From 561ef3d43d94bdf098fee37295d7588905ec0c9e Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 7 Nov 2023 22:38:03 +0100 Subject: improve getCommitHashes `getCommitHashes` now returns at least one commit, and reverses commits by default (ie. oldest to newset). --- app/History/PartialCommitInfo.hs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'app/History/PartialCommitInfo.hs') diff --git a/app/History/PartialCommitInfo.hs b/app/History/PartialCommitInfo.hs index 2337ef7..cd8cd46 100644 --- a/app/History/PartialCommitInfo.hs +++ b/app/History/PartialCommitInfo.hs @@ -8,6 +8,7 @@ import Control.Exception (catch) import Data.Binary (Binary) import Data.ByteString.Lazy.Char8 qualified as LB8 import Data.Function ((&)) +import Data.List.NonEmpty qualified as N import Data.Text qualified as T import Die (die) import Exception qualified as E @@ -35,13 +36,7 @@ data PartialCommitInfo = PartialCommitInfo getPartialCommitInfos :: IO [PartialCommitInfo] getPartialCommitInfos = do - -- TODO Revise `getCommitHashes` - -- - -- - Should throw if no commits. - -- - Should always be reversed? - -- - -- @difficulty easy - commitHashes <- reverse <$> Git.getCommitHashes + commitHashes <- N.toList <$> Git.getCommitHashes parMapM getCommitInfoOf (map Commit commitHashes ++ [WorkingTree]) getCommitInfoOf :: CommitHash -> IO PartialCommitInfo -- cgit v1.2.3