summaryrefslogtreecommitdiff
path: root/Types/FileMatcher.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2021-03-02 12:47:23 -0400
committerJoey Hess <joeyh@joeyh.name>2021-03-02 13:39:31 -0400
commitcbf94fd13d93c6e10ee5973e265d5caf94a08750 (patch)
tree83677641b620aa724fb92b26427ee07767a8259e /Types/FileMatcher.hs
parentee4fd38ecfd54fe635d921c9e4abb8170dd8ae2c (diff)
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.
Diffstat (limited to 'Types/FileMatcher.hs')
-rw-r--r--Types/FileMatcher.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Types/FileMatcher.hs b/Types/FileMatcher.hs
index 8ac1274d1d..cf251cd47d 100644
--- a/Types/FileMatcher.hs
+++ b/Types/FileMatcher.hs
@@ -1,6 +1,6 @@
{- git-annex file matcher types
-
- - Copyright 2013-2020 Joey Hess <id@joeyh.name>
+ - Copyright 2013-2021 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@@ -8,7 +8,8 @@
module Types.FileMatcher where
import Types.UUID (UUID)
-import Types.Key (Key, AssociatedFile)
+import Types.Key (Key)
+import Types.Link (LinkType)
import Types.Mime
import Utility.Matcher (Matcher, Token)
import Utility.FileSize
@@ -21,10 +22,6 @@ import qualified Data.Set as S
-- Information about a file and/or a key that can be matched on.
data MatchInfo
= MatchingFile FileInfo
- | MatchingKey Key AssociatedFile
- -- ^ This is used when matching a file that may be in another
- -- branch. The AssociatedFile is the filename, but it should not be
- -- accessed from disk when matching.
| MatchingInfo ProvidedInfo
| MatchingUserInfo UserProvidedInfo
@@ -41,11 +38,13 @@ data FileInfo = FileInfo
}
data ProvidedInfo = ProvidedInfo
- { providedFilePath :: RawFilePath
+ { providedFilePath :: Maybe RawFilePath
+ -- ^ filepath to match on, should not be accessed from disk.
, providedKey :: Maybe Key
- , providedFileSize :: FileSize
+ , providedFileSize :: Maybe FileSize
, providedMimeType :: Maybe MimeType
, providedMimeEncoding :: Maybe MimeEncoding
+ , providedLinkType :: Maybe LinkType
}
-- This is used when testing a matcher, with values to match against