From f849fe4f8bd424a57de870d6cb8f038221dd7ff2 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Fri, 20 Oct 2023 09:55:53 +0200 Subject: add internal tag @modifiedAt --- app/History/CommitInfo.hs | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'app/History/CommitInfo.hs') diff --git a/app/History/CommitInfo.hs b/app/History/CommitInfo.hs index b42e1ba..5285e68 100644 --- a/app/History/CommitInfo.hs +++ b/app/History/CommitInfo.hs @@ -46,14 +46,18 @@ fromPartialCommitInfos (partialCommitInfo : partialCommitInfos) = Just new { provenance = - (\oldProvenance newProvenance -> - ( I.Provenance - { first = oldProvenance.first, - last = newProvenance.last - } - ) + ( \oldProvenance newProvenance -> + ( I.Provenance + { first = oldProvenance.first, + last = + if clear old /= clear new + then newProvenance.last + else oldProvenance.last + } + ) ) - <$> old.provenance <*> new.provenance, + <$> old.provenance + <*> new.provenance, internalTags = I.internalTags new.title old.provenance } ) @@ -91,21 +95,22 @@ diffCommitInfos oldInfo newInfo = newIssues = newInfo.issues oldIssues = oldInfo.issues - -- TODO Fix issue comparison - -- - -- Because issues carry `provenance` and `internalTags`, issues compare - -- unequally when we want them to be equal. - clear i = - i - { provenance = Nothing, - internalTags = [], - start = Position 0 0, - end = Position 0 0, - file = "" - } - eq = (==) `on` id +-- TODO Fix issue comparison +-- +-- Because issues carry `provenance` and `internalTags`, issues compare +-- unequally when we want them to be equal. +clear :: Issue -> Issue +clear i = + i + { provenance = Nothing, + internalTags = [], + 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 -- cgit v1.2.3