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.)
This commit is contained in:
parent
dcded89129
commit
94ee28556f
1 changed files with 7 additions and 4 deletions
11
Limit.hs
11
Limit.hs
|
@ -18,6 +18,7 @@ import qualified Remote
|
||||||
import qualified Backend
|
import qualified Backend
|
||||||
import LocationLog
|
import LocationLog
|
||||||
import Utility
|
import Utility
|
||||||
|
import Content
|
||||||
|
|
||||||
type Limit = Utility.Matcher.Token (FilePath -> Annex Bool)
|
type Limit = Utility.Matcher.Token (FilePath -> Annex Bool)
|
||||||
|
|
||||||
|
@ -64,17 +65,19 @@ addExclude glob = addlimit $ return . notExcluded
|
||||||
regex = '^':wildToRegex glob
|
regex = '^':wildToRegex glob
|
||||||
|
|
||||||
{- Adds a limit to skip files not believed to be present
|
{- Adds a limit to skip files not believed to be present
|
||||||
- on a specfied remote. -}
|
- on a specfied repository. -}
|
||||||
addIn :: String -> Annex ()
|
addIn :: String -> Annex ()
|
||||||
addIn name = do
|
addIn name = do
|
||||||
u <- Remote.nameToUUID name
|
u <- Remote.nameToUUID name
|
||||||
addlimit $ check u
|
addlimit $ if name == "." then check local else check (remote u)
|
||||||
where
|
where
|
||||||
check u f = Backend.lookupFile f >>= handle u
|
check a f = Backend.lookupFile f >>= handle a
|
||||||
handle _ Nothing = return False
|
handle _ Nothing = return False
|
||||||
handle u (Just (key, _)) = do
|
handle a (Just (key, _)) = a key
|
||||||
|
remote u key = do
|
||||||
us <- keyLocations key
|
us <- keyLocations key
|
||||||
return $ u `elem` us
|
return $ u `elem` us
|
||||||
|
local key = inAnnex key
|
||||||
|
|
||||||
{- Adds a limit to skip files not believed to have the specified number
|
{- Adds a limit to skip files not believed to have the specified number
|
||||||
- of copies. -}
|
- of copies. -}
|
||||||
|
|
Loading…
Reference in a new issue