Prevent combinations of options such as --all with --include
Previously such nonsensical combinations always treated the matching option as if it didn't match. For now, made find --branch refuse matching options that need a filename, because one is not provided to them in a way they'll use. There's an open bug report to support it, but making it error out is better than the old behavior of not finding what it was asked to. Also, made --mimetype combined with eg --all work, by looking at the object file when operating on keys.
This commit is contained in:
parent
7a089f05b2
commit
25e4ab7e81
4 changed files with 37 additions and 10 deletions
6
Limit.hs
6
Limit.hs
|
@ -159,14 +159,16 @@ matchMagic
|
|||
matchMagic _limitname querymagic selectprovidedinfo selectuserprovidedinfo (Just magic) glob =
|
||||
Right $ MatchFiles
|
||||
{ matchAction = const go
|
||||
, matchNeedsFileName = True
|
||||
, matchNeedsFileName = False
|
||||
, matchNeedsFileContent = True
|
||||
, matchNeedsKey = False
|
||||
, matchNeedsLocationLog = False
|
||||
}
|
||||
where
|
||||
cglob = compileGlob glob CaseSensative (GlobFilePath False) -- memoized
|
||||
go (MatchingKey _ _) = pure False
|
||||
go (MatchingKey k _) = withObjectLoc k $ \obj ->
|
||||
maybe False (matchGlob cglob)
|
||||
<$> querymagic magic (fromRawFilePath obj)
|
||||
go (MatchingFile fi) = case contentFile fi of
|
||||
Just f -> catchBoolIO $
|
||||
maybe False (matchGlob cglob)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue