split ProvidedInfo and UserProvidedInfo
The latter is for git-annex matchexpression and matching against it can throw an exception. Splitting out the former reduces the potential for mistakes and avoids needing to worry about matching against that throwing an exception. This is more groundwork for matching largefiles while importing, without downloading content. This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
parent
00dbe35fbc
commit
8b74f01a26
7 changed files with 93 additions and 62 deletions
|
@ -541,15 +541,12 @@ wantImport :: FileMatcher Annex -> ImportLocation -> ByteSize -> Annex Bool
|
|||
wantImport matcher loc sz = checkMatcher' matcher mi mempty
|
||||
where
|
||||
mi = MatchingInfo $ ProvidedInfo
|
||||
{ providedFilePath = Right $ fromRawFilePath $ fromImportLocation loc
|
||||
, providedKey = unavail "key"
|
||||
, providedFileSize = Right sz
|
||||
, providedMimeType = unavail "mime"
|
||||
, providedMimeEncoding = unavail "mime"
|
||||
{ providedFilePath = fromImportLocation loc
|
||||
, providedKey = Nothing
|
||||
, providedFileSize = sz
|
||||
, providedMimeType = Nothing
|
||||
, providedMimeEncoding = Nothing
|
||||
}
|
||||
-- This should never run, as long as the FileMatcher was generated
|
||||
-- using the preferredContentKeylessTokens.
|
||||
unavail v = Left $ error $ "Internal error: unavailable " ++ v
|
||||
|
||||
{- If a file is not preferred content, but it was previously exported or
|
||||
- imported to the remote, not importing it would result in a remote
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue