summaryrefslogtreecommitdiff
path: root/Backend/File.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Backend/File.hs')
-rw-r--r--Backend/File.hs19
1 files changed, 15 insertions, 4 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index b99a064ae..15d8f4a26 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -44,9 +44,18 @@ mustProvide = error "must provide this field"
dummyStore :: FilePath -> Key -> Annex (Bool)
dummyStore file key = return True
-{- Just check if the .git/annex/ file for the key exists. -}
+{- Just check if the .git/annex/ file for the key exists.
+ -
+ - But, if running against a remote annex, need to use ssh to do it. -}
checkKeyFile :: Key -> Annex Bool
-checkKeyFile k = inAnnex k
+checkKeyFile k = do
+ g <- Annex.gitRepo
+ if (not $ Git.repoIsUrl g)
+ then inAnnex k
+ else do
+ showNote ("checking " ++ Git.repoDescribe g ++ "...")
+ liftIO $ boolSystem "ssh" [Git.urlHost g,
+ "test -e " ++ (shellEscape $ annexLocation g k)]
{- Try to find a copy of the file in one of the remotes,
- and copy it over to this one. -}
@@ -85,11 +94,13 @@ copyFromRemote r key file = do
then getssh
else error "copying from non-ssh repo not supported"
where
- location = annexLocation r key
getlocal = boolSystem "cp" ["-a", location, file]
getssh = do
liftIO $ putStrLn "" -- make way for scp progress bar
- boolSystem "scp" [location, file]
+ -- TODO double-shell-quote path for scp
+ boolSystem "scp" [sshlocation, file]
+ location = annexLocation r key
+ sshlocation = (Git.urlHost r) ++ ":" ++ location
showLocations :: Key -> Annex ()
showLocations key = do