summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-07 12:43:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-07 12:43:56 -0400
commit2356a2557a65073bc61fc909a5806615129114d3 (patch)
treecb2460b15957628834403bb4f1c30c903dbf09e8 /Command
parent657f2518895dd055f083140ff644c144cbe72305 (diff)
Fix direct mode getKeysPresent false positive & also sped up direct mode unused and unannex
unused: In direct mode, files that are deleted from the work tree are no longer incorrectly detected as unused. Direct mode `git annex info` slows down a bit due to more stringent checking, but not by a lot.
Diffstat (limited to 'Command')
-rw-r--r--Command/Info.hs2
-rw-r--r--Command/Uninit.hs2
-rw-r--r--Command/Unused.hs4
3 files changed, 5 insertions, 3 deletions
diff --git a/Command/Info.hs b/Command/Info.hs
index f27fdfb1d..11ed98cd9 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -281,7 +281,7 @@ cachedPresentData = do
case presentData s of
Just v -> return v
Nothing -> do
- v <- foldKeys <$> lift getKeysPresent
+ v <- foldKeys <$> lift (getKeysPresent InRepository)
put s { presentData = Just v }
return v
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index 1c8d08689..2a9e3e687 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -53,7 +53,7 @@ finish :: Annex ()
finish = do
annexdir <- fromRepo gitAnnexDir
annexobjectdir <- fromRepo gitAnnexObjectDir
- leftovers <- removeUnannexed =<< getKeysPresent
+ leftovers <- removeUnannexed =<< getKeysPresent InAnnex
if null leftovers
then liftIO $ removeDirectoryRecursive annexdir
else error $ unlines
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 6b4475568..c174cd256 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -71,7 +71,9 @@ checkUnused = chain 0
return []
findunused False = do
showAction "checking for unused data"
- excludeReferenced =<< getKeysPresent
+ -- InAnnex, not InRepository because if a direct mode
+ -- file exists, it is obviously not unused.
+ excludeReferenced =<< getKeysPresent InAnnex
chain _ [] = next $ return True
chain v (a:as) = do
v' <- a v