started converting Ref from String to ByteString

This should make code that reads shas and refs from git faster.

Does not compile yet, a lot needs to be done still.
This commit is contained in:
Joey Hess 2020-04-06 17:14:49 -04:00
parent 6e9714612b
commit 279991604d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
17 changed files with 80 additions and 51 deletions

View file

@ -15,6 +15,9 @@ import Git.Command
import Git.Sha
import qualified Data.Set as S
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
data History t = History t (S.Set (History t))
deriving (Show, Eq, Ord)
@ -53,8 +56,9 @@ getHistoryToDepth n commit r = do
!h <- fmap (truncateHistoryToDepth n)
. build Nothing
. map parsehistorycommit
. lines
<$> hGetContents inh
. map B.copy
. B8.lines
<$> L.hGetContents inh
hClose inh
void $ waitForProcess pid
return h
@ -93,7 +97,7 @@ getHistoryToDepth n commit r = do
, Param "--format=%T %H %P"
]
parsehistorycommit l = case map extractSha (splitc ' ' l) of
parsehistorycommit l = case map extractSha (S8.split ' ' l) of
(Just t:Just c:ps) -> Just $
( HistoryCommit
{ historyCommit = c