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 /Command/Unused.hs | |
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 'Command/Unused.hs')
-rw-r--r-- | Command/Unused.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs index 7bf252243..857d7dabf 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -21,6 +21,7 @@ import qualified Git import qualified Git.Command import qualified Git.Ref import qualified Git.Branch +import qualified Git.RefLog import qualified Git.LsFiles as LsFiles import qualified Git.DiffTree as DiffTree import qualified Backend @@ -216,8 +217,9 @@ withKeysReferencedInGit :: RefSpec -> (Key -> Annex ()) -> Annex () withKeysReferencedInGit refspec a = do current <- inRepo Git.Branch.currentUnsafe shaHead <- maybe (return Nothing) (inRepo . Git.Ref.sha) current - usedrefs <- applyRefSpec refspec . relevantrefs (shaHead, current) + rs <- relevantrefs (shaHead, current) <$> inRepo (Git.Command.pipeReadStrict [Param "show-ref"]) + usedrefs <- applyRefSpec refspec rs (inRepo Git.RefLog.getAll) forM_ usedrefs $ withKeysReferencedInGitRef a where |