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.
This commit is contained in:
parent
5c58e9c101
commit
e481ca7658
1 changed files with 3 additions and 3 deletions
|
@ -172,8 +172,8 @@ toDirectGen :: Key -> FilePath -> Annex (Maybe (Annex ()))
|
||||||
toDirectGen k f = do
|
toDirectGen k f = do
|
||||||
loc <- inRepo $ gitAnnexLocation k
|
loc <- inRepo $ gitAnnexLocation k
|
||||||
createContentDir loc -- thaws directory too
|
createContentDir loc -- thaws directory too
|
||||||
top <- fromRepo Git.repoPath
|
absf <- liftIO $ absPath f
|
||||||
locs <- filter (/= normalise (top </> f)) <$> addAssociatedFile k f
|
locs <- filter (/= absf) <$> addAssociatedFile k f
|
||||||
case locs of
|
case locs of
|
||||||
[] -> ifM (liftIO $ doesFileExist loc)
|
[] -> ifM (liftIO $ doesFileExist loc)
|
||||||
( return $ Just $ do
|
( return $ Just $ do
|
||||||
|
@ -183,7 +183,7 @@ toDirectGen k f = do
|
||||||
liftIO $ replaceFile f $ moveFile loc
|
liftIO $ replaceFile f $ moveFile loc
|
||||||
, return Nothing
|
, 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. -}
|
{- Another direct file has the content; copy it. -}
|
||||||
( return $ Just $ do
|
( return $ Just $ do
|
||||||
liftIO $ replaceFile f $
|
liftIO $ replaceFile f $
|
||||||
|
|
Loading…
Add table
Reference in a new issue