diff options
author | Joey Hess <joey@kitenet.net> | 2012-02-01 16:05:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-02-01 16:16:08 -0400 |
commit | 3d49258e5bed4d9a6ec9e24ddb776f277542664b (patch) | |
tree | 89af32cbdde6a5e672c357c24fe281337e2a133a /Git/UnionMerge.hs | |
parent | 6c64a214fa569dcf1fa8cc4c79efd90d01ff5705 (diff) |
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.
Diffstat (limited to 'Git/UnionMerge.hs')
-rw-r--r-- | Git/UnionMerge.hs | 9 |
1 files changed, 5 insertions, 4 deletions
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 |