diff --git a/src/Command.hs b/src/Command.hs index 7ee30f2e2..14f4d2668 100644 --- a/src/Command.hs +++ b/src/Command.hs @@ -56,7 +56,7 @@ readFilesAtSHAs -> [FilePath] -- ^ Specific paths to diff. If empty, diff all changed paths. -> String -- ^ The commit sha for the before state. -> String -- ^ The commit sha for the after state. - -> Command [(SourceBlob, SourceBlob)] -- ^ A command producing a list of pairs of blobs for the specified files (or all files if none were specified). + -> Command [Both SourceBlob] -- ^ A command producing a list of pairs of blobs for the specified files (or all files if none were specified). readFilesAtSHAs gitDir alternateObjectDirs paths sha1 sha2 = ReadFilesAtSHAs gitDir alternateObjectDirs paths sha1 sha2 `Then` return -- | Parse a blob in a given language. @@ -92,7 +92,7 @@ runCommand = iterFreerA $ \ command yield -> case command of data CommandF f where ReadFile :: FilePath -> CommandF SourceBlob - ReadFilesAtSHAs :: FilePath -> [FilePath] -> [FilePath] -> String -> String -> CommandF [(SourceBlob, SourceBlob)] + ReadFilesAtSHAs :: FilePath -> [FilePath] -> [FilePath] -> String -> String -> CommandF [Both SourceBlob] Parse :: Maybe Language -> SourceBlob -> CommandF (Term (Syntax Text) (Record DefaultFields)) @@ -108,7 +108,7 @@ runReadFile path = do source <- readAndTranscodeFile path return (sourceBlob source path) -runReadFilesAtSHAs :: FilePath -> [FilePath] -> [FilePath] -> String -> String -> IO [(SourceBlob, SourceBlob)] +runReadFilesAtSHAs :: FilePath -> [FilePath] -> [FilePath] -> String -> String -> IO [Both SourceBlob] runReadFilesAtSHAs gitDir alternateObjectDirs paths sha1 sha2 = withRepository lgFactory gitDir $ do repo <- getRepository for_ alternateObjectDirs (liftIO . odbBackendAddPath repo . toS) @@ -126,7 +126,7 @@ runReadFilesAtSHAs gitDir alternateObjectDirs paths sha1 sha2 = withRepository l pure $! (a \\ b) <> (b \\ a) - blobs <- for paths $ \ path -> (,) <$> blobForPathInTree path tree1 <*> blobForPathInTree path tree2 + blobs <- for paths $ \ path -> both <$> blobForPathInTree path tree1 <*> blobForPathInTree path tree2 liftIO $! traceEventIO ("END readFilesAtSHAs: " <> show paths) return blobs diff --git a/src/SemanticDiff.hs b/src/SemanticDiff.hs index 689876ce1..8f1d1107f 100644 --- a/src/SemanticDiff.hs +++ b/src/SemanticDiff.hs @@ -40,9 +40,9 @@ main = do CommitDiff -> do blobPairs <- readFilesAtSHAs gitDir alternateObjectDirs filePaths (fromMaybe (toS nullOid) (fst shaRange)) (fromMaybe (toS nullOid) (snd shaRange)) for blobPairs $ \ blobs -> do - terms <- traverse parseBlob (Join blobs) + terms <- traverse parseBlob blobs diff' <- runBothWith diff terms - return (Join blobs, diff') + return (blobs, diff') render diffs Parse -> case format of R.Index -> parseIndex args