summaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-26 14:05:07 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-26 14:16:27 -0400
commit0d048cb1f2df7672b2c77802edc994182ff1458d (patch)
tree5c37177488bc07d402bd5fdaa906c1c0748cf020 /Remote/Git.hs
parent483abf98b1949b88c3e96c987378be23f8ed869a (diff)
deal with unlocked files when calling rsyncParamsRemote
In copyFromRemote, it used to check isDirect, but that was not needed; the remote is sending the file, so it doesn't matter if the local, receiving repository is in direct mode or not. And, since the content is not present, yet, it's certianly not unlocked. Note that, the remote may indeed be sending an unlocked file, but sendkey uses sendAnnex, which will detect if the file is modified before or during transfer, and will exit nonzero, aborting the upload. So, the receiver doesn't need any checks. In copyToRemote, it forces recvkey to verify content whenever it's being sent from a v6 repository. recvkey is almost always going to verify content anyway, unless annex.verify is not set. So, this doesn't make it any more expensive, except for in that unusual configuration. The alternative would be to change the recvkey interface, so that the sender checks afterwards if what it was sending changed, and the receiver then throws out the bad transfer. That would be less expensive for the reciever, as it would not need to do a checksum verification. But, it would mean another network round trip, and since rsync closes the connection, it would need to open another ssh connection to do this. Even with connction caching, that would add latency to uploads. It would also complicate the interface, especially because an older git-annex-shell would not have the new interface available. For these reasons, I prefer punting on that at this time, and instead someone might set annex.verify=false and be unhappy that it still verifies.. (One other gotcha not dealt with is that a v5 repo could be upgraded to v6 while an upload is in progress, and a file unlocked and modified.) (Also, I double-checked Remote.GCrypt's calls to rsyncParamsRemote, and they're fine. When a file is being uploaded to gcrypt, or any other special repository, it is mediated by sendAnnex, so changes will be detected at that level and the special remote implementation doesn't need to worry about them.)
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 6dc5345c9..d68059030 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -1,6 +1,6 @@
{- Standard git remotes.
-
- - Copyright 2011-2012 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2015 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -35,6 +35,7 @@ import Utility.Tmp
import Config
import Config.Cost
import Annex.Init
+import Annex.Version
import Types.Key
import Types.CleanupActions
import qualified CmdLine.GitAnnexShell.Fields as Fields
@@ -442,9 +443,8 @@ copyFromRemote' r key file dest meterupdate
file noRetry noObserver
(\p -> copier object dest (combineMeterUpdate p meterupdate) checksuccess)
| Git.repoIsSsh (repo r) = unVerified $ feedprogressback $ \p -> do
- direct <- isDirect
Ssh.rsyncHelper (Just (combineMeterUpdate meterupdate p))
- =<< Ssh.rsyncParamsRemote direct r Download key dest file
+ =<< Ssh.rsyncParamsRemote False r Download key dest file
| Git.repoIsHttp (repo r) = unVerified $
Annex.Content.downloadUrl key meterupdate (keyUrls r key) dest
| otherwise = error "copying from non-ssh, non-http remote not supported"
@@ -545,15 +545,18 @@ copyToRemote' r key file meterupdate
copylocal =<< Annex.Content.prepSendAnnex key
| Git.repoIsSsh (repo r) = commitOnCleanup r $
Annex.Content.sendAnnex key noop $ \object -> do
- direct <- isDirect
+ -- This is too broad really, but recykey normally
+ -- verifies content anyway, so avoid complicating
+ -- it with a local sendAnnex check and rollback.
+ unlocked <- isDirect <||> versionSupportsUnlockedPointers
Ssh.rsyncHelper (Just meterupdate)
- =<< Ssh.rsyncParamsRemote direct r Upload key object file
+ =<< Ssh.rsyncParamsRemote unlocked r Upload key object file
| otherwise = error "copying to non-ssh repo not supported"
where
copylocal Nothing = return False
copylocal (Just (object, checksuccess)) = do
-- The checksuccess action is going to be run in
- -- the remote's Annex, but it needs access to the current
+ -- the remote's Annex, but it needs access to the local
-- Annex monad's state.
checksuccessio <- Annex.withCurrentState checksuccess
params <- Ssh.rsyncParams r Upload