Special remotes now all rollback storage of keys that get modified during the transfer, which can happen in direct mode.

This commit is contained in:
Joey Hess 2013-01-09 18:42:29 -04:00
parent b3559d8eae
commit 1bc49b7158
11 changed files with 63 additions and 44 deletions

View file

@ -103,12 +103,12 @@ runHook hooktype hook k f a = maybe (return False) run =<< lookupHook hooktype h
)
store :: String -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
store h k _f _p = sendAnnex k $ \src ->
store h k _f _p = sendAnnex k (void $ remove h k) $ \src ->
runHook h "store" k (Just src) $ return True
storeEncrypted :: String -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
storeEncrypted h (cipher, enck) k _p = withTmp enck $ \tmp ->
sendAnnex k $ \src -> do
sendAnnex k (void $ remove h enck) $ \src -> do
liftIO $ encrypt cipher (feedFile src) $
readBytes $ L.writeFile tmp
runHook h "store" enck (Just tmp) $ return True