summaryrefslogtreecommitdiff
path: root/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-29 23:43:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-29 23:48:57 -0400
commit7ff89ccfee13dcfe89cbdef83454e880dabd7186 (patch)
tree953858f36ccd021832d286c6a5915e44a05081ce /Branch.hs
parent949ef94d5e5583e55d6ba9797cf71177b252173d (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 'Branch.hs')
-rw-r--r--Branch.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Branch.hs b/Branch.hs
index 92b1fe29e..e4caeece7 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -30,6 +30,7 @@ import System.IO
import System.IO.Binary
import System.Posix.Process
import System.Exit
+import qualified Data.ByteString.Lazy.Char8 as L
import Types.BranchState
import qualified Git
@@ -181,7 +182,7 @@ siblingBranches :: Annex [String]
siblingBranches = do
g <- Annex.gitRepo
r <- liftIO $ Git.pipeRead g [Param "show-ref", Param name]
- return $ map (last . words) (lines r)
+ return $ map (last . words . L.unpack) (L.lines r)
{- Ensures that a given ref has been merged into the index. -}
updateRef :: GitRef -> Annex (Maybe String)
@@ -196,7 +197,7 @@ updateRef ref
Param (name++".."++ref),
Params "--oneline -n1"
]
- if null diffs
+ if L.null diffs
then return Nothing
else do
showSideAction $ "merging " ++ Git.refDescribe ref ++ " into " ++ name