Speed up the 'unused' command.
Instead of populating the second-level Bloom filter with every key referenced in every Git reference, consider only those which differ from what's referenced in the index. Incidentaly, unlike with its old behavior, staged modifications/deletion/... will now be detected by 'unused'. Credits to joeyh for the algorithm. :-)
This commit is contained in:
parent
2794f4fb48
commit
f15fda60ed
4 changed files with 32 additions and 26 deletions
|
@ -12,6 +12,7 @@ import Command
|
|||
import qualified Command.Add
|
||||
import qualified Command.Fix
|
||||
import qualified Git.DiffTree
|
||||
import qualified Git.Ref
|
||||
import Annex.CatFile
|
||||
import Annex.Content.Direct
|
||||
import Git.Sha
|
||||
|
@ -38,7 +39,7 @@ startIndirect file = next $ do
|
|||
|
||||
startDirect :: [String] -> CommandStart
|
||||
startDirect _ = next $ do
|
||||
(diffs, clean) <- inRepo $ Git.DiffTree.diffIndex
|
||||
(diffs, clean) <- inRepo $ Git.DiffTree.diffIndex Git.Ref.headRef
|
||||
forM_ diffs go
|
||||
next $ liftIO clean
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue