Only look at reflogs for relevant branches, not for git-annex branches

This speeds it up quite a bit.. May still be too slow in large repos.
This commit is contained in:
Joey Hess 2015-07-07 17:31:30 -04:00
parent 600717417f
commit 24800b1bf1
3 changed files with 9 additions and 9 deletions

View file

@ -14,18 +14,17 @@ import Git.Sha
{- Gets the reflog for a given branch. -}
get :: Branch -> Repo -> IO [Sha]
get b = get' [] (Just b)
get b = getMulti [b]
{- Gets all reflogs for all branches. -}
getAll :: Repo -> IO [Sha]
getAll = get' [Param "--all"] Nothing
{- Gets reflogs for multiple branches. -}
getMulti :: [Branch] -> Repo -> IO [Sha]
getMulti bs = get' (map (Param . fromRef) bs)
get' :: [CommandParam] -> Maybe Branch -> Repo -> IO [Sha]
get' ps b = mapMaybe extractSha . lines <$$> pipeReadStrict ps'
get' :: [CommandParam] -> Repo -> IO [Sha]
get' ps = mapMaybe extractSha . lines <$$> pipeReadStrict ps'
where
ps' = catMaybes
[ Just $ Param "log"
, Just $ Param "-g"
, Just $ Param "--format=%H"
, Param . fromRef <$> b
] ++ ps