diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-15 22:40:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-15 22:40:40 -0400 |
commit | 922e9af5281b01709e5fa631ebe048c7da7c4d71 (patch) | |
tree | b79f24f9f83c9067ec5915578ada6e0f89e6889e | |
parent | b76dc2d210889a77160a834e3849e3040ef69b12 (diff) |
cleanup
-rw-r--r-- | Git/UnionMerge.hs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs index 460c76716..493411a06 100644 --- a/Git/UnionMerge.hs +++ b/Git/UnionMerge.hs @@ -16,7 +16,6 @@ module Git.UnionMerge ( import System.Cmd.Utils import Data.List import Data.Maybe -import Data.String.Utils import qualified Data.ByteString.Lazy.Char8 as L import Common @@ -88,18 +87,6 @@ calc_merge h differ repo = do pairs (_:[]) = error "calc_merge parse error" pairs (a:b:rest) = (a,b):pairs rest -{- Injects some content into git, returning its hash. -} -hashObject :: L.ByteString -> Repo -> IO String -hashObject content repo = getSha subcmd $ do - (h, s) <- pipeWriteRead (map Param params) content repo - L.length s `seq` do - forceSuccess h - reap -- XXX unsure why this is needed - return $ L.unpack s - where - subcmd = "hash-object" - params = [subcmd, "-w", "--stdin"] - {- Given an info line from a git raw diff, and the filename, generates - a line suitable for update_index that union merges the two sides of the - diff. -} @@ -115,3 +102,15 @@ mergeFile (info, file) h repo = case filter (/= nullsha) [asha, bsha] of [_colonamode, _bmode, asha, bsha, _status] = words info nullsha = replicate shaSize '0' unionmerge = L.unlines . nub . L.lines + +{- Injects some content into git, returning its hash. -} +hashObject :: L.ByteString -> Repo -> IO String +hashObject content repo = getSha subcmd $ do + (h, s) <- pipeWriteRead (map Param params) content repo + L.length s `seq` do + forceSuccess h + reap -- XXX unsure why this is needed + return $ L.unpack s + where + subcmd = "hash-object" + params = [subcmd, "-w", "--stdin"] |