diff options
author | Joey Hess <joey@kitenet.net> | 2013-01-06 13:57:53 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-01-06 13:57:53 -0400 |
commit | 3bac971ac22afd706d7ad52013c86a7dae80c684 (patch) | |
tree | d84f64fbe45cac543314ab55cf69898a0ecd3948 /Annex/Direct.hs | |
parent | 314d4754e3aeae62a00a833db4c7daa8022b1d9a (diff) |
direct: Avoid hardlinking symlinks that point to the same content when the content is not present.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r-- | Annex/Direct.hs | 7 |
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 () |