1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Delete or Insert entire diff if one side of the source blobs is empty

This commit is contained in:
joshvera 2016-07-11 12:57:10 -04:00
parent 1dfae9a1b9
commit 680fe1304c

View File

@ -87,7 +87,7 @@ diffFiles parser renderer sourceBlobs = do
terms <- sequence $ parser <$> sources
let replaceLeaves = breakDownLeavesByWord <$> sources
let areNullOids = runJoin $ (== nullOid) . oid <$> sourceBlobs
let areNullOids = runBothWith (\a b -> (oid a == nullOid || length (source a) == 0, oid b == nullOid || length (source b) == 0)) sourceBlobs
let textDiff = case areNullOids of
(True, False) -> pure $ Insert (snd terms)
(False, True) -> pure $ Delete (fst terms)