summaryrefslogtreecommitdiff
path: root/Command/PreCommit.hs
diff options
context:
space:
mode:
authorGravatar guilhem <guilhem@fripost.org>2013-08-26 02:47:49 +0200
committerGravatar Joey Hess <joey@kitenet.net>2013-08-25 21:02:13 -0400
commitdf48567279fa504ca31d9f4f25b06066f08d1128 (patch)
tree8b40f2d55abe2e74f870696db131536c43794116 /Command/PreCommit.hs
parentb20ea840b89f7b1584b3cadcc195508ff824ad54 (diff)
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. :-)
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r--Command/PreCommit.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index 565344d25..c6d9dd278 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -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