diff options
Diffstat (limited to 'Git/UnionMerge.hs')
-rw-r--r-- | Git/UnionMerge.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs index 19db32860..15bff6052 100644 --- a/Git/UnionMerge.hs +++ b/Git/UnionMerge.hs @@ -107,21 +107,22 @@ mergeFile :: String -> FilePath -> CatFileHandle -> Repo -> IO (Maybe String) mergeFile info file h repo = case filter (/= nullSha) [Ref asha, Ref bsha] of [] -> return Nothing (sha:[]) -> use sha - shas -> use =<< either return (hashObject repo . L.unlines) =<< + shas -> use =<< either return (hashObject repo . unlines) =<< calcMerge . zip shas <$> mapM getcontents shas where [_colonmode, _bmode, asha, bsha, _status] = words info - getcontents s = L.lines . L.decodeUtf8 <$> catObject h s + getcontents s = map L.unpack . L.lines . + L.decodeUtf8 <$> catObject h s use sha = return $ Just $ update_index_line sha file {- Injects some content into git, returning its Sha. -} -hashObject :: Repo -> L.Text -> IO Sha +hashObject :: Repo -> String -> IO Sha hashObject repo content = getSha subcmd $ do (h, s) <- pipeWriteRead (map Param params) content repo - L.length s `seq` do + length s `seq` do forceSuccess h reap -- XXX unsure why this is needed - return $ L.unpack s + return s where subcmd = "hash-object" params = [subcmd, "-w", "--stdin"] @@ -131,7 +132,7 @@ hashObject repo content = getSha subcmd $ do - When possible, reuses the content of an existing ref, rather than - generating new content. -} -calcMerge :: [(Ref, [L.Text])] -> Either Ref [L.Text] +calcMerge :: [(Ref, [String])] -> Either Ref [String] calcMerge shacontents | null reuseable = Right $ new | otherwise = Left $ fst $ Prelude.head reuseable |