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 +++++-- debian/changelog | 2 ++ ...x_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn | 5 +++++ 3 files changed, 12 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 () diff --git a/debian/changelog b/debian/changelog index 59021ca7c..7e9ff845d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ git-annex (3.20130105) UNRELEASED; urgency=low drop, log. * assistant: Detect when system is not configured with a user name, and set environment to prevent git from failing. + * direct: Avoid hardlinking symlinks that point to the same content + when the content is not present. -- Joey Hess Thu, 03 Jan 2013 14:58:45 -0400 diff --git a/doc/bugs/git-annex_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn b/doc/bugs/git-annex_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn index 278eb1e0f..de88b0246 100644 --- a/doc/bugs/git-annex_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn +++ b/doc/bugs/git-annex_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn @@ -22,3 +22,8 @@ Running 3.20130102 on OSX ## Please provide any additional information below. +> More specifically, git annex direct fails, on OSX only, when there are two +> files that both have the same content. Apparently OSX doesn't allow +> hard linking two symbolic links together. There was no harm in it doing that +> otherwise, but then again no reason for it to do so, so I've put in a fix. +> [[done]] --[[Joey]] -- cgit v1.2.3