direct: Avoid hardlinking symlinks that point to the same content when the content is not present.

This commit is contained in:
Joey Hess 2013-01-06 13:57:53 -04:00
parent 82dbbfc0c3
commit e457be7631
3 changed files with 12 additions and 2 deletions

View file

@ -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 ()

2
debian/changelog vendored
View file

@ -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

View file

@ -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]]