From 3bac971ac22afd706d7ad52013c86a7dae80c684 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Jan 2013 13:57:53 -0400 Subject: direct: Avoid hardlinking symlinks that point to the same content when the content is not present. --- Annex/Direct.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Annex/Direct.hs') 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 () -- cgit v1.2.3