From 3d49258e5bed4d9a6ec9e24ddb776f277542664b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 1 Feb 2012 16:05:02 -0400 Subject: attempt at a quick, utf-8 only fix to the ghc 7.4 problem If you have only utf-8 filenames, and need to build git-annex with ghc 7.4, this will work. But, it will crash on non-utf-8 filenames. --- Git/UnionMerge.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Git/UnionMerge.hs') diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs index 4b335e47b..19db32860 100644 --- a/Git/UnionMerge.hs +++ b/Git/UnionMerge.hs @@ -15,7 +15,8 @@ module Git.UnionMerge ( ) where import System.Cmd.Utils -import qualified Data.ByteString.Lazy.Char8 as L +import qualified Data.Text.Lazy as L +import qualified Data.Text.Lazy.Encoding as L import qualified Data.Set as S import Common @@ -110,11 +111,11 @@ mergeFile info file h repo = case filter (/= nullSha) [Ref asha, Ref bsha] of calcMerge . zip shas <$> mapM getcontents shas where [_colonmode, _bmode, asha, bsha, _status] = words info - getcontents s = L.lines <$> catObject h s + getcontents s = 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.ByteString -> IO Sha +hashObject :: Repo -> L.Text -> IO Sha hashObject repo content = getSha subcmd $ do (h, s) <- pipeWriteRead (map Param params) content repo L.length s `seq` do @@ -130,7 +131,7 @@ hashObject repo content = getSha subcmd $ do - When possible, reuses the content of an existing ref, rather than - generating new content. -} -calcMerge :: [(Ref, [L.ByteString])] -> Either Ref [L.ByteString] +calcMerge :: [(Ref, [L.Text])] -> Either Ref [L.Text] calcMerge shacontents | null reuseable = Right $ new | otherwise = Left $ fst $ Prelude.head reuseable -- cgit v1.2.3