aboutsummaryrefslogtreecommitdiffstats
path: root/app/History.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/History.hs')
-rw-r--r--app/History.hs24
1 files changed, 4 insertions, 20 deletions
diff --git a/app/History.hs b/app/History.hs
index c04d16a..bd8af43 100644
--- a/app/History.hs
+++ b/app/History.hs
@@ -45,26 +45,10 @@ instance Exception InvalidTreeGrepperResult
listIssues :: [Filter] -> [FilePath] -> IO [Issue]
listIssues filters files = do
commits <- fmap (lines . decodeUtf8 . L8.toStrict) $ sh ("git log --format=%H")
- issueses <-
- parMapM
- ( \maybeCommit ->
- case maybeCommit of
- Nothing ->
- listIssuesCurrent files
- Just commit ->
- cached commit (\_ -> listIssuesOf commit)
- )
- $ (:) Nothing
- $ map Just commits
- (currentIssues, historicalIssues) <-
- case issueses of
- currentIssues : historicalIssueses ->
- pure (currentIssues, concat historicalIssueses)
- [] ->
- die "no commits"
- pure $
- map (merge . pick historicalIssues) $
- filter (applyFilter filters) currentIssues
+ currentIssues <- listIssuesCurrent files
+ historicalIssues <- fmap concat $ parMapM (\commit -> cached commit (\_ -> listIssuesOf commit)) commits
+ let currentIssuesFiltered = filter (applyFilter filters) currentIssues
+ pure $ map (merge . pick historicalIssues) currentIssuesFiltered
pick :: [Issue] -> Issue -> (Issue, [Issue])
pick issues issue =