aboutsummaryrefslogtreecommitdiff
path: root/Git/UnionMerge.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-27 16:14:33 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-27 16:14:33 -0400
commit8baff14054e65ecbe801eb66786a55fa5245cb30 (patch)
tree6b94664f942ecbbda6def84cbe2b75bba10ce8f2 /Git/UnionMerge.hs
parent3ede3a809725a1ce612730218aa52349f785b0de (diff)
parent6677a99cb42e40baedfc98b1602171ec0c14f86b (diff)
Merge branch 'master' into assistant
Diffstat (limited to 'Git/UnionMerge.hs')
-rw-r--r--Git/UnionMerge.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs
index 0987f9131..504147e1d 100644
--- a/Git/UnionMerge.hs
+++ b/Git/UnionMerge.hs
@@ -10,8 +10,7 @@ module Git.UnionMerge (
mergeIndex
) where
-import qualified Data.Text.Lazy as L
-import qualified Data.Text.Lazy.Encoding as L
+import qualified Data.ByteString.Lazy as L
import qualified Data.Set as S
import Common
@@ -79,10 +78,14 @@ 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 = map L.unpack . L.lines .
- L.decodeUtf8 <$> catObject h s
use sha = return $ Just $
updateIndexLine sha FileBlob $ asTopFilePath file
+ -- We don't know how the file is encoded, but need to
+ -- split it into lines to union merge. Using the
+ -- FileSystemEncoding for this is a hack, but ensures there
+ -- are no decoding errors. Note that this works because
+ -- streamUpdateIndex sets fileEncoding on its write handle.
+ getcontents s = lines . encodeW8 . L.unpack <$> catObject h s
{- Calculates a union merge between a list of refs, with contents.
-