summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-19 01:52:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-19 01:52:17 -0400
commit94ee28556fb0c42b774e0af9f69fbf9cb5f04d01 (patch)
treeae9c1eda6e8d2f5cca3e2a125c34d9786f97347a /Limit.hs
parentdcded89129c4647bc71b474aac6d3e334b4321c1 (diff)
special case for --in .
Do not need to check the location log in this case, can just check inAnnex. This is both an optimisation and perhaps a correctness measure (fsck --in . should fsck files even if the location log is damaged.)
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Limit.hs b/Limit.hs
index 2482c8a65..d8ec4484c 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -18,6 +18,7 @@ import qualified Remote
import qualified Backend
import LocationLog
import Utility
+import Content
type Limit = Utility.Matcher.Token (FilePath -> Annex Bool)
@@ -64,17 +65,19 @@ addExclude glob = addlimit $ return . notExcluded
regex = '^':wildToRegex glob
{- Adds a limit to skip files not believed to be present
- - on a specfied remote. -}
+ - on a specfied repository. -}
addIn :: String -> Annex ()
addIn name = do
u <- Remote.nameToUUID name
- addlimit $ check u
+ addlimit $ if name == "." then check local else check (remote u)
where
- check u f = Backend.lookupFile f >>= handle u
+ check a f = Backend.lookupFile f >>= handle a
handle _ Nothing = return False
- handle u (Just (key, _)) = do
+ handle a (Just (key, _)) = a key
+ remote u key = do
us <- keyLocations key
return $ u `elem` us
+ local key = inAnnex key
{- Adds a limit to skip files not believed to have the specified number
- of copies. -}