diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-29 23:43:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-29 23:48:57 -0400 |
commit | 7ff89ccfee13dcfe89cbdef83454e880dabd7186 (patch) | |
tree | 953858f36ccd021832d286c6a5915e44a05081ce /Git/UnionMerge.hs | |
parent | 949ef94d5e5583e55d6ba9797cf71177b252173d (diff) |
convert all git read/write functions to use ByteStrings
This yields a second or so speedup in unused, find, etc. Seems that even
when the ByteString is immediately split and then converted to Strings,
it's faster.
I may try to push ByteStrings out into more of git-annex gradually,
although I suspect most of the time-critical parts are already covered
now, and many of the rest rely on libraries that only support Strings.
Diffstat (limited to 'Git/UnionMerge.hs')
-rw-r--r-- | Git/UnionMerge.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Git/UnionMerge.hs b/Git/UnionMerge.hs index a2b85dbdc..ac002b374 100644 --- a/Git/UnionMerge.hs +++ b/Git/UnionMerge.hs @@ -19,7 +19,6 @@ import Data.String.Utils import qualified Data.ByteString.Lazy.Char8 as L import Git -import qualified Git.ByteString as GitB import Utility.SafeCommand {- Performs a union merge between two branches, staging it in the index. @@ -44,7 +43,7 @@ merge _ _ = error "wrong number of branches to merge" update_index :: Repo -> [String] -> IO () update_index g l = togit ["update-index", "-z", "--index-info"] (join "\0" l) where - togit ps content = pipeWrite g (map Param ps) content + togit ps content = pipeWrite g (map Param ps) (L.pack content) >>= forceSuccess {- Generates a line suitable to be fed into update-index, to add @@ -83,7 +82,7 @@ calc_merge g differ = do {- Injects some content into git, returning its hash. -} hashObject :: Repo -> L.ByteString -> IO String hashObject repo content = getSha subcmd $ do - (h, s) <- GitB.pipeWriteRead repo (map Param params) content + (h, s) <- pipeWriteRead repo (map Param params) content L.length s `seq` do forceSuccess h reap -- XXX unsure why this is needed @@ -100,7 +99,7 @@ mergeFile g (info, file) = case filter (/= nullsha) [asha, bsha] of [] -> return Nothing (sha:[]) -> return $ Just $ update_index_line sha file shas -> do - content <- GitB.pipeRead g $ map Param ("show":shas) + content <- pipeRead g $ map Param ("show":shas) sha <- hashObject g $ unionmerge content return $ Just $ update_index_line sha file where |