summaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index e44081639..cd0d1c3b9 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -190,10 +190,13 @@ toDirectGen k f = do
liftIO $ replaceFile f $ moveFile loc
, return Nothing
)
- (loc':_) -> return $ Just $ do
+ (loc':_) -> ifM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f)
{- Another direct file has the content, so
- hard link to it. -}
- liftIO $ replaceFile f $ createLink loc'
+ ( return $ Just $ do
+ liftIO $ replaceFile f $ createLink loc'
+ , return Nothing
+ )
{- Removes a direct mode file, while retaining its content. -}
removeDirect :: Key -> FilePath -> Annex ()