add key to FileInfo

MatchingKey is not the thing to use when matching on actual worktreee
files.

Fix reversion in 8.20201116 that made include= and exclude= in
preferred/required content expressions match a path relative to the current
directory, rather than the path from the top of the repository.
This commit is contained in:
Joey Hess 2020-12-14 17:42:02 -04:00
parent 205a837e8a
commit 01527b21d8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
13 changed files with 48 additions and 13 deletions

View file

@ -72,7 +72,8 @@ checkMatcher :: FileMatcher Annex -> Maybe Key -> AssociatedFile -> AssumeNotPre
checkMatcher matcher mkey afile notpresent notconfigured d
| isEmpty matcher = notconfigured
| otherwise = case (mkey, afile) of
(Nothing, AssociatedFile (Just file)) -> go =<< fileMatchInfo file
(mkey, AssociatedFile (Just file)) ->
go =<< fileMatchInfo file mkey
(Just key, _) -> go (MatchingKey key afile)
_ -> d
where
@ -82,12 +83,13 @@ checkMatcher' :: FileMatcher Annex -> MatchInfo -> AssumeNotPresent -> Annex Boo
checkMatcher' matcher mi notpresent =
matchMrun matcher $ \o -> matchAction o notpresent mi
fileMatchInfo :: RawFilePath -> Annex MatchInfo
fileMatchInfo file = do
fileMatchInfo :: RawFilePath -> Maybe Key -> Annex MatchInfo
fileMatchInfo file mkey = do
matchfile <- getTopFilePath <$> inRepo (toTopFilePath file)
return $ MatchingFile FileInfo
{ matchFile = matchfile
, contentFile = Just file
, matchKey = mkey
}
matchAll :: FileMatcher Annex