summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-06 13:57:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-06 13:57:53 -0400
commit3bac971ac22afd706d7ad52013c86a7dae80c684 (patch)
treed84f64fbe45cac543314ab55cf69898a0ecd3948
parent314d4754e3aeae62a00a833db4c7daa8022b1d9a (diff)
direct: Avoid hardlinking symlinks that point to the same content when the content is not present.
-rw-r--r--Annex/Direct.hs7
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/git-annex_direct_fails_on_repositories_with_a_partial_set_of_files.mdwn5
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 <joeyh@debian.org> 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]]