fix lockKey to run callback in original Annex monad, not local remote's

This commit is contained in:
Joey Hess 2015-10-09 13:35:28 -04:00
parent 4c6095b6f5
commit 865dd11dbf
Failed to extract signature
2 changed files with 16 additions and 3 deletions

View file

@ -361,10 +361,15 @@ dropKey r key
| otherwise = commitOnCleanup r $ Ssh.dropKey (repo r) key
lockKey :: Remote -> Key -> (VerifiedCopy -> Annex r) -> Annex r
lockKey r key a
lockKey r key callback
| not $ Git.repoIsUrl (repo r) =
guardUsable (repo r) cantlock $
onLocal r $ Annex.Content.lockContentShared key a
guardUsable (repo r) cantlock $ do
inorigrepo <- Annex.makeRunner
-- Lock content from perspective of remote,
-- and then run the callback in the original
-- annex monad, not the remote's.
onLocal r $ Annex.Content.lockContentShared key $
liftIO . inorigrepo . callback
| Git.repoIsHttp (repo r) = cantlock
| otherwise = error "TODO"
where