--explain for preferred/required content matching

And annex.largefiles and annex.addunlocked.

Also git-annex matchexpression --explain explains why its input
expression matches or fails to match.

When there is no limit, avoid explaining why the lack of limit
matches. This is also done when no preferred content expression is set,
although in a few cases it defaults to a non-empty matcher, which will
be explained.

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2023-07-26 14:34:21 -04:00
parent ba1c222912
commit 518a51a8a0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 89 additions and 60 deletions

View file

@ -1,6 +1,6 @@
{- git-annex command
-
- Copyright 2016 Joey Hess <id@joeyh.name>
- Copyright 2016-2023 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -10,7 +10,6 @@ module Command.MatchExpression where
import Command
import Annex.FileMatcher
import Utility.DataUnits
import Utility.Matcher
import Annex.UUID
import Logs.Group
@ -84,15 +83,14 @@ seek o = do
, configMap = M.empty
, repoUUID = Just u
}
case parsedToMatcher $ parser ((matchexpr o)) of
case parsedToMatcher (MatcherDesc "provided expression") $ parser ((matchexpr o)) of
Left e -> liftIO $ bail $ "bad expression: " ++ e
Right matcher -> ifM (checkmatcher matcher)
( liftIO exitSuccess
, liftIO exitFailure
)
where
checkmatcher matcher = matchMrun matcher $ \op ->
matchAction op S.empty (matchinfo o)
checkmatcher matcher = checkMatcher' matcher (matchinfo o) S.empty
bail :: String -> IO a
bail s = do