summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Directory.hs10
-rw-r--r--Remote/Git.hs13
2 files changed, 17 insertions, 6 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 2eeb79317..916013172 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -162,9 +162,13 @@ retrieveCheap _ (UnpaddedChunks _) _ _ = return False
retrieveCheap _ (LegacyChunks _) _ _ = return False
#ifndef mingw32_HOST_OS
retrieveCheap d NoChunks k f = liftIO $ catchBoolIO $ do
- file <- getLocation d k
- createSymbolicLink file f
- return True
+ file <- absPath =<< getLocation d k
+ ifM (doesFileExist file)
+ ( do
+ createSymbolicLink file f
+ return True
+ , return False
+ )
#else
retrieveCheap _ _ _ _ = return False
#endif
diff --git a/Remote/Git.hs b/Remote/Git.hs
index abefc113e..fdd0049ca 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -445,10 +445,17 @@ copyFromRemote' r key file dest
copyFromRemoteCheap :: Remote -> Key -> FilePath -> Annex Bool
#ifndef mingw32_HOST_OS
copyFromRemoteCheap r key file
- | not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ do
- loc <- liftIO $ gitAnnexLocation key (repo r) $
+ | not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ liftIO $ do
+ loc <- gitAnnexLocation key (repo r) $
fromJust $ remoteGitConfig $ gitconfig r
- liftIO $ catchBoolIO $ createSymbolicLink loc file >> return True
+ ifM (doesFileExist loc)
+ ( do
+ absloc <- absPath loc
+ catchBoolIO $ do
+ createSymbolicLink absloc file
+ return True
+ , return False
+ )
| Git.repoIsSsh (repo r) =
ifM (Annex.Content.preseedTmp key file)
( copyFromRemote' r key Nothing file