1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Simplify how we deal with empty source blobs.

This commit is contained in:
Rob Rix 2017-04-03 20:11:12 -04:00
parent 39abcaa282
commit ceecfa00b1
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ main = do
blobs <- traverse readFile paths
terms <- traverse (traverse parseBlob) blobs
diff' <- runBothWith maybeDiff terms
return [(fromMaybe <$> (emptySourceBlob <$> paths) <*> blobs, diff')]
return [(fromMaybe . emptySourceBlob <$> paths <*> blobs, diff')]
CommitDiff -> do
blobPairs <- readFilesAtSHAs gitDir alternateObjectDirs filePaths (fromMaybe (toS nullOid) (fst shaRange)) (fromMaybe (toS nullOid) (snd shaRange))
for blobPairs . uncurry $ \ path blobs -> do

View File

@ -123,7 +123,7 @@ testDiff renderer paths expectedOutput = do
blobs <- traverse readFile paths
terms <- traverse (traverse parseBlob) blobs
Just diff' <- runBothWith maybeDiff terms
return (fromMaybe <$> (emptySourceBlob <$> paths) <*> blobs, diff')
return (fromMaybe . emptySourceBlob <$> paths <*> blobs, diff')
let diffOutput = renderer blobs diff'
let actual = Verbatim (stripWhitespace diffOutput)
expected <- Verbatim . stripWhitespace <$> B.readFile expectedOutput