diff options
author | Fabian Kirchner <kirchner@posteo.de> | 2023-10-14 19:01:59 +0200 |
---|---|---|
committer | Fabian Kirchner <kirchner@posteo.de> | 2023-10-14 19:01:59 +0200 |
commit | 7d77a88d714cccc1e8a0c408b7bacf58122f6ae2 (patch) | |
tree | 6d8daf8b9f88d0301af55ce4da36650db47a9d2a /app/History.hs | |
parent | 546362889058de55bc32551a613385b2d5166365 (diff) |
filter issues by paths
Diffstat (limited to 'app/History.hs')
-rw-r--r-- | app/History.hs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/History.hs b/app/History.hs index a12ea6e..21709ae 100644 --- a/app/History.hs +++ b/app/History.hs @@ -12,7 +12,7 @@ import Data.Function ((&)) import Data.List (foldl', intercalate) import Data.Maybe (catMaybes, mapMaybe) import Data.String (fromString) -import Data.Text (Text, append, lines, pack, unpack) +import Data.Text (Text, append, isPrefixOf, lines, pack, unpack) import Data.Text.Encoding (decodeUtf8) import GHC.Generics (Generic) import Issue (Issue (..), fromMatch, id) @@ -43,8 +43,16 @@ listIssues filters paths = do let eventses = getEvents hashFirst issuesInitial (commitInfos ++ [commitInfoWorkingTree]) let issues = mapMaybe issueFromIssueEvents eventses issuesFiltered = filter (applyFilter filters) issues - -- FIXME We have to only consider issues in the specified paths - pure issuesFiltered + issuesWithinPaths = + case paths of + [] -> + issuesFiltered + _ -> + filter withinPaths issuesFiltered + pure issuesWithinPaths + where + withinPaths issue = + any (\path -> isPrefixOf (pack path) (pack issue.file)) paths getCommitHashes :: IO [Text] getCommitHashes = |