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.
This commit is contained in:
parent
a51b98cdd5
commit
b11d2f5a8a
7 changed files with 40 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue