1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 23:46:21 +03:00

Use pathKeyForBlobPair

This commit is contained in:
Timothy Clem 2017-12-14 10:16:51 -08:00
parent d2df5d2120
commit 7bbe2b1341

View File

@ -21,7 +21,6 @@ import Data.Aeson
import Data.Align (bicrosswalk)
import Data.Bifoldable (bifoldMap)
import Data.Bifunctor (bimap)
import Data.Bifunctor.Join
import Data.Blob
import Data.ByteString.Lazy (toStrict)
import Data.Diff
@ -164,11 +163,7 @@ renderToCDiff :: (HasField fields (Maybe Declaration), HasField fields Span, Fol
renderToCDiff blobs = uncurry Summaries . bimap toMap toMap . List.partition isValidSummary . diffTOC
where toMap [] = mempty
toMap as = Map.singleton summaryKey (toJSON <$> as)
summaryKey = T.pack $ case bimap blobPath blobPath (runJoin blobs) of
This before -> before
That after -> after
These before after | before == after -> after
| otherwise -> before <> " -> " <> after
summaryKey = T.pack $ pathKeyForBlobPair blobs
diffTOC :: (HasField fields (Maybe Declaration), HasField fields Span, Foldable f, Functor f) => Diff f (Record fields) (Record fields) -> [TOCSummary]
diffTOC = mapMaybe entrySummary . dedupe . tableOfContentsBy declaration