diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-11-27 13:42:57 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-27 13:43:00 +0100 |
commit | a1222f548e865b86bc29a712560968a9d2a30710 (patch) | |
tree | b79e27a95b3cc42fa3d696ca84c7d91b67f820d7 /app/History | |
parent | 1731c0484c9bd32cb8f312529e192fb4bdd99dba (diff) |
make provenance obligatory
Diffstat (limited to 'app/History')
-rw-r--r-- | app/History/CommitInfo.hs | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/app/History/CommitInfo.hs b/app/History/CommitInfo.hs index 94e2f96..3c371d1 100644 --- a/app/History/CommitInfo.hs +++ b/app/History/CommitInfo.hs @@ -46,18 +46,13 @@ fromPartialCommitInfos (partialCommitInfo : partialCommitInfos) = Just new { provenance = - ( \oldProvenance newProvenance -> - ( I.Provenance - { first = oldProvenance.first, - last = - if clear old /= clear new - then newProvenance.last - else oldProvenance.last - } - ) - ) - <$> old.provenance - <*> new.provenance + I.Provenance + { first = old.provenance.first, + last = + if ((/=) `on` (.rawText)) old new + then new.provenance.last + else old.provenance.last + } } ) ( \old -> @@ -85,7 +80,7 @@ diffCommitInfos oldInfo newInfo = [ [IssueCreated newHash issue | issue <- deleteFirstsBy eq newIssues oldIssues], [ IssueChanged newHash (last issues) | issues <- intersectBy' eq newIssues oldIssues, - not (null [(x, y) | x <- issues, y <- issues, clear x /= clear y]) + not (null [(x, y) | x <- issues, y <- issues, ((/=) `on` (.rawText)) x y]) ], [IssueDeleted newHash issue | issue <- deleteFirstsBy eq oldIssues newIssues] ] @@ -96,19 +91,6 @@ diffCommitInfos oldInfo newInfo = eq = (==) `on` id --- TODO Fix issue comparison --- --- Because issues carry `provenance` issues compare unequally when we want --- them to be equal. -clear :: Issue -> Issue -clear i = - i - { provenance = Nothing, - start = Position 0 0, - end = Position 0 0, - file = "" - } - mergeListsBy :: (a -> a -> Bool) -> (a -> a -> b) -> (a -> b) -> (a -> b) -> [a] -> [a] -> [b] mergeListsBy eq onBoth onLeft onRight lefts rights = concat |