aboutsummaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-18 12:39:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-18 12:39:26 -0400
commit4808ab8f8b0c0502d5341c501f8972ad4f0037d4 (patch)
treefc0c5440d18432347635137983be6c3eeffa8bf1 /Annex/Direct.hs
parent8a90ce164c90aef0fd9b7e992bb36935e7a963c5 (diff)
some more direct mode fixes
Avoid a crash if a mapping contains files that no longer exist. This could happen because eg, one was deleted and a commit has not yet been done to update the mapping. Fix path calculation.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 71ba4b41e..f43c94fcb 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -172,8 +172,8 @@ toDirectGen :: Key -> FilePath -> Annex (Maybe (Annex ()))
toDirectGen k f = do
loc <- inRepo $ gitAnnexLocation k
createContentDir loc -- thaws directory too
- top <- fromRepo Git.repoPath
- locs <- filter (/= normalise (top </> f)) <$> addAssociatedFile k f
+ absf <- liftIO $ absPath f
+ locs <- filter (/= absf) <$> addAssociatedFile k f
case locs of
[] -> ifM (liftIO $ doesFileExist loc)
( return $ Just $ do
@@ -183,7 +183,7 @@ toDirectGen k f = do
liftIO $ replaceFile f $ moveFile loc
, return Nothing
)
- (loc':_) -> ifM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus loc')
+ (loc':_) -> ifM (liftIO $ catchBoolIO $ not . isSymbolicLink <$> getSymbolicLinkStatus loc')
{- Another direct file has the content; copy it. -}
( return $ Just $ do
liftIO $ replaceFile f $