fix some matchNeedsFileName values

matchMagic: Always False for MatchingKey. Unsure why.. Could be a bug?

limitUnused: Behaves differently when there is a filename.

limitSize: When used with LimitDiskFiles, checks the size on disk of the
filename.
This commit is contained in:
Joey Hess 2020-09-24 16:08:47 -04:00
parent 051e16a945
commit b7afcda887
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -66,6 +66,11 @@ getMatcher' = go =<< Annex.getState Annex.limit
s { Annex.limit = CompleteMatcher matcher }
return matcher
{- Checks if the user-specified limits contains anything that meets the
- condition. -}
introspect :: (MatchFiles Annex -> Bool) -> Annex Bool
introspect c = any c <$> getMatcher'
{- Adds something to the limit list, which is built up reversed. -}
add :: Utility.Matcher.Token (MatchFiles Annex) -> Annex ()
add l = Annex.changeState $ \s -> s { Annex.limit = prepend $ Annex.limit s }
@ -138,7 +143,7 @@ matchMagic :: String -> (Magic -> FilePath -> Annex (Maybe String)) -> (Provided
matchMagic _limitname querymagic selectprovidedinfo (Just magic) glob =
Right $ MatchFiles
{ matchAction = const go
, matchNeedsFileName = False
, matchNeedsFileName = True
, matchNeedsFileContent = True
}
where
@ -303,7 +308,7 @@ limitLackingCopies approx want = case readish want of
limitUnused :: MatchFiles Annex
limitUnused = MatchFiles
{ matchAction = go
, matchNeedsFileName = False
, matchNeedsFileName = True
, matchNeedsFileContent = False
}
where
@ -390,7 +395,9 @@ limitSize lb vs s = case readSize dataUnits s of
Nothing -> Left "bad size"
Just sz -> Right $ MatchFiles
{ matchAction = go sz
, matchNeedsFileName = False
, matchNeedsFileName = case lb of
LimitAnnexFiles -> False
LimitDiskFiles -> True
, matchNeedsFileContent = False
}
where