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 /Command | |
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 'Command')
-rw-r--r-- | Command/Copy.hs | 4 | ||||
-rw-r--r-- | Command/Drop.hs | 2 | ||||
-rw-r--r-- | Command/Get.hs | 2 | ||||
-rw-r--r-- | Command/Sync.hs | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/Command/Copy.hs b/Command/Copy.hs index 395992ed0..e2bd1fce4 100644 --- a/Command/Copy.hs +++ b/Command/Copy.hs @@ -37,5 +37,5 @@ start to from file (key, backend) = stopUnless shouldCopy $ where shouldCopy = checkAuto (check <||> numCopiesCheck file key (<)) check = case to of - Nothing -> wantGet False (Just file) - Just r -> wantSend False (Just file) (Remote.uuid r) + Nothing -> wantGet False (Just key) (Just file) + Just r -> wantSend False (Just key) (Just file) (Remote.uuid r) diff --git a/Command/Drop.hs b/Command/Drop.hs index bf832e8d5..d17302035 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -34,7 +34,7 @@ seek ps = do start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart start from file (key, _) = checkDropAuto from file key $ \numcopies -> - stopUnless (checkAuto $ wantDrop False (Remote.uuid <$> from) (Just file)) $ + stopUnless (checkAuto $ wantDrop False (Remote.uuid <$> from) (Just key) (Just file)) $ case from of Nothing -> startLocal (Just file) numcopies key Nothing Just remote -> do diff --git a/Command/Get.hs b/Command/Get.hs index cdb85af94..fb2145fdd 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -36,7 +36,7 @@ seek ps = do start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart start from file (key, _) = start' expensivecheck from key (Just file) where - expensivecheck = checkAuto (numCopiesCheck file key (<) <||> wantGet False (Just file)) + expensivecheck = checkAuto (numCopiesCheck file key (<) <||> wantGet False (Just key) (Just file)) startKeys :: Maybe Remote -> Key -> CommandStart startKeys from key = start' (return True) from key Nothing diff --git a/Command/Sync.hs b/Command/Sync.hs index 9db3c7ad7..5763709ac 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -519,7 +519,7 @@ syncFile rs f (k, _) = do wantget have = allM id [ pure (not $ null have) , not <$> inAnnex k - , wantGet True (Just f) + , wantGet True (Just k) (Just f) ] handleget have = ifM (wantget have) ( return [ get have ] @@ -531,7 +531,7 @@ syncFile rs f (k, _) = do wantput r | Remote.readonly r || remoteAnnexReadOnly (Types.Remote.gitconfig r) = return False - | otherwise = wantSend True (Just f) (Remote.uuid r) + | otherwise = wantSend True (Just k) (Just f) (Remote.uuid r) handleput lack = ifM (inAnnex k) ( map put <$> (filterM wantput lack) , return [] |