prep for fixing find --branch --unlocked

Added LinkType to ProvidedInfo, and unified MatchingKey with
ProvidedInfo. They're both used in the same way, so there was no real
reason to keep separate.

Note that addLocked and addUnlocked still set matchNeedsFileName,
because to handle MatchingFile, they do need it. However, they
don't use it when MatchingInfo is provided. This should be ok,
the --branch case will be able skip checking matchNeedsFileName,
since it will provide a filename in any case.
This commit is contained in:
Joey Hess 2021-03-02 12:47:23 -04:00
parent ee4fd38ecf
commit cbf94fd13d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 91 additions and 46 deletions

View file

@ -454,11 +454,12 @@ importKeys remote importtreeconfig importcontent thirdpartypopulated importablec
when (Utility.Matcher.introspect matchNeedsFileContent matcher) $
giveup "annex.largefiles configuration examines file contents, so cannot import without content."
let mi = MatchingInfo ProvidedInfo
{ providedFilePath = f
{ providedFilePath = Just f
, providedKey = Nothing
, providedFileSize = sz
, providedFileSize = Just sz
, providedMimeType = Nothing
, providedMimeEncoding = Nothing
, providedLinkType = Nothing
}
islargefile <- checkMatcher' matcher mi mempty
metered Nothing sz $ const $ if islargefile
@ -703,11 +704,12 @@ matchesImportLocation :: FileMatcher Annex -> ImportLocation -> Integer -> Annex
matchesImportLocation matcher loc sz = checkMatcher' matcher mi mempty
where
mi = MatchingInfo $ ProvidedInfo
{ providedFilePath = fromImportLocation loc
{ providedFilePath = Just (fromImportLocation loc)
, providedKey = Nothing
, providedFileSize = sz
, providedFileSize = Just sz
, providedMimeType = Nothing
, providedMimeEncoding = Nothing
, providedLinkType = Nothing
}
notIgnoredImportLocation :: ImportTreeConfig -> CheckGitIgnore -> ImportLocation -> Annex Bool