diff options
author | Joey Hess <joey@kitenet.net> | 2014-01-23 16:37:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-01-23 16:44:02 -0400 |
commit | 5112650348f6bf04cebe1fb97ed900b24e4aaac1 (patch) | |
tree | 4e207b96021812213d237e68d156e2e0bbdf32c3 /Logs | |
parent | 425c6ddfcd84b6bf26f3a277d010df1fb6b018da (diff) |
fix transfers of key with no associated file
Several places assumed this would not happen, and when the AssociatedFile
was Nothing, did nothing.
As part of this, preferred content checks pass the Key around.
Note that checkMatcher is sometimes now called with Just Key and Just File.
It currently constructs a FileMatcher, ignoring the Key. However, if it
constructed a FileKeyMatcher, which contained both, then it might be
possible to speed up parts of Limit, which currently call the somewhat
expensive lookupFileKey to get the Key.
I have not made this optimisation yet, because I am not sure if the key is
always the same. Will need some significant checking to satisfy myself
that's the case..
Diffstat (limited to 'Logs')
-rw-r--r-- | Logs/PreferredContent.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs index 2a9aed36b..4b25ea094 100644 --- a/Logs/PreferredContent.hs +++ b/Logs/PreferredContent.hs @@ -38,13 +38,13 @@ import Types.StandardGroups {- Checks if a file is preferred content for the specified repository - (or the current repository if none is specified). -} -isPreferredContent :: Maybe UUID -> AssumeNotPresent -> FilePath -> Bool -> Annex Bool -isPreferredContent mu notpresent file def = do +isPreferredContent :: Maybe UUID -> AssumeNotPresent -> Maybe Key -> AssociatedFile -> Bool -> Annex Bool +isPreferredContent mu notpresent mkey afile def = do u <- maybe getUUID return mu m <- preferredContentMap case M.lookup u m of Nothing -> return def - Just matcher -> checkFileMatcher' matcher file notpresent def + Just matcher -> checkMatcher matcher mkey afile notpresent def {- The map is cached for speed. -} preferredContentMap :: Annex Annex.PreferredContentMap |