From b7afcda88753ab663d9e626df733a656585f55b9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 24 Sep 2020 16:08:47 -0400 Subject: [PATCH] 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. --- Limit.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Limit.hs b/Limit.hs index 2caff89f71..8335a273a6 100644 --- a/Limit.hs +++ b/Limit.hs @@ -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 -- 2.30.2