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:
parent
051e16a945
commit
b7afcda887
1 changed files with 10 additions and 3 deletions
13
Limit.hs
13
Limit.hs
|
@ -66,6 +66,11 @@ getMatcher' = go =<< Annex.getState Annex.limit
|
||||||
s { Annex.limit = CompleteMatcher matcher }
|
s { Annex.limit = CompleteMatcher matcher }
|
||||||
return 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. -}
|
{- Adds something to the limit list, which is built up reversed. -}
|
||||||
add :: Utility.Matcher.Token (MatchFiles Annex) -> Annex ()
|
add :: Utility.Matcher.Token (MatchFiles Annex) -> Annex ()
|
||||||
add l = Annex.changeState $ \s -> s { Annex.limit = prepend $ Annex.limit s }
|
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 =
|
matchMagic _limitname querymagic selectprovidedinfo (Just magic) glob =
|
||||||
Right $ MatchFiles
|
Right $ MatchFiles
|
||||||
{ matchAction = const go
|
{ matchAction = const go
|
||||||
, matchNeedsFileName = False
|
, matchNeedsFileName = True
|
||||||
, matchNeedsFileContent = True
|
, matchNeedsFileContent = True
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
@ -303,7 +308,7 @@ limitLackingCopies approx want = case readish want of
|
||||||
limitUnused :: MatchFiles Annex
|
limitUnused :: MatchFiles Annex
|
||||||
limitUnused = MatchFiles
|
limitUnused = MatchFiles
|
||||||
{ matchAction = go
|
{ matchAction = go
|
||||||
, matchNeedsFileName = False
|
, matchNeedsFileName = True
|
||||||
, matchNeedsFileContent = False
|
, matchNeedsFileContent = False
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
@ -390,7 +395,9 @@ limitSize lb vs s = case readSize dataUnits s of
|
||||||
Nothing -> Left "bad size"
|
Nothing -> Left "bad size"
|
||||||
Just sz -> Right $ MatchFiles
|
Just sz -> Right $ MatchFiles
|
||||||
{ matchAction = go sz
|
{ matchAction = go sz
|
||||||
, matchNeedsFileName = False
|
, matchNeedsFileName = case lb of
|
||||||
|
LimitAnnexFiles -> False
|
||||||
|
LimitDiskFiles -> True
|
||||||
, matchNeedsFileContent = False
|
, matchNeedsFileContent = False
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue