diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-07 17:13:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-07 17:13:50 -0400 |
commit | 986b2eb33a8a973cc0690e4dfed0f5b50d0719f9 (patch) | |
tree | 519bb536f18287c8be890aaad6e6ef93639c8825 /Git | |
parent | cfb055f838da0c51a50224bf759b42fb263dcfec (diff) |
unused: --used-refspec can now be configured to look at refs in the reflog. This provides a way to not consider old versions of files to be unused after they have reached a specified age, when the old refs in the reflog expire.
May be slow.
Diffstat (limited to 'Git')
-rw-r--r-- | Git/RefLog.hs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Git/RefLog.hs b/Git/RefLog.hs index 7c20047ad..940bb10a1 100644 --- a/Git/RefLog.hs +++ b/Git/RefLog.hs @@ -14,14 +14,18 @@ import Git.Sha {- Gets the reflog for a given branch. -} get :: Branch -> Repo -> IO [Sha] -get = get' [] +get b = get' [] (Just b) -get' :: [CommandParam] -> Branch -> Repo -> IO [Sha] +{- Gets all reflogs for all branches. -} +getAll :: Repo -> IO [Sha] +getAll = get' [Param "--all"] Nothing + +get' :: [CommandParam] -> Maybe Branch -> Repo -> IO [Sha] get' ps b = mapMaybe extractSha . lines <$$> pipeReadStrict ps' where - ps' = - [ Param "log" - , Param "-g" - , Param "--format=%H" - , Param (fromRef b) + ps' = catMaybes + [ Just $ Param "log" + , Just $ Param "-g" + , Just $ Param "--format=%H" + , Param . fromRef <$> b ] ++ ps |