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

@ -115,6 +115,7 @@ withPathContents a params = do
checkmatch matcher (f, relf) = matcher $ MatchingFile $ FileInfo
{ contentFile = Just f
, matchFile = relf
, matchKey = Nothing
}
withWords :: ([String] -> CommandSeek) -> CmdParams -> CommandSeek
@ -287,7 +288,7 @@ seekFiltered prefilter a listfs = do
where
process matcher v@(_si, f) =
whenM (prefilter v) $
whenM (matcher $ MatchingFile $ FileInfo (Just f) f) $
whenM (matcher $ MatchingFile $ FileInfo (Just f) f Nothing) $
a v
data MatcherInfo = MatcherInfo
@ -365,7 +366,7 @@ seekFilteredKeys seeker listfs = do
-- checked later, to avoid a slow lookup here.
(not ((matcherNeedsKey mi || matcherNeedsLocationLog mi)
&& not (matcherNeedsFileName mi)))
(MatchingFile $ FileInfo (Just f) f)
(MatchingFile $ FileInfo (Just f) f Nothing)
(liftIO $ ofeeder ((si, f), sha))
keyaction f mi content a =