diff options
author | Joey Hess <joey@kitenet.net> | 2014-09-05 13:44:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-09-05 13:44:09 -0400 |
commit | 6cade5c9d59566314fe63d30f648dde1abe33a32 (patch) | |
tree | 17e5a54a64dad37d128873b4748b35474b2a46b0 /Remote | |
parent | 95c95a78f1d9cf00b7d706691cbee40ba4f21cf8 (diff) |
New annex.hardlink setting. Closes: #758593
* New annex.hardlink setting. Closes: #758593
* init: Automatically detect when a repository was cloned with --shared,
and set annex.hardlink=true, as well as marking the repository as
untrusted.
Had to reorganize Logs.Trust a bit to avoid a cycle between it and
Annex.Init.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Git.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 0c760c3aa..6397c1a2e 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -355,15 +355,27 @@ copyFromRemote' r key file dest | not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ do params <- Ssh.rsyncParams r Download u <- getUUID + hardlink <- annexHardLink <$> Annex.getGitConfig -- run copy from perspective of remote onLocal r $ do ensureInitialized v <- Annex.Content.prepSendAnnex key case v of Nothing -> return False - Just (object, checksuccess) -> - runTransfer (Transfer Download u key) file noRetry - (rsyncOrCopyFile params object dest) + Just (object, checksuccess) -> do + let copier = rsyncOrCopyFile params object dest +#ifndef mingw32_HOST_OS + let linker = createLink object dest >> return True + go <- ifM (pure hardlink <&&> not <$> isDirect) + ( return $ \m -> liftIO (catchBoolIO linker) + <||> copier m + , return copier + ) +#else + let go = copier +#endif + runTransfer (Transfer Download u key) + file noRetry go <&&> checksuccess | Git.repoIsSsh (repo r) = feedprogressback $ \feeder -> do direct <- isDirect |