guard readSymbolicLink

throws an exception if the file is not a symlink
This commit is contained in:
Joey Hess 2013-01-05 16:07:27 -04:00
parent 20fafc6a2d
commit aedfcde969
2 changed files with 7 additions and 6 deletions

View file

@ -23,7 +23,7 @@ seek = [withFilesInGit $ whenAnnexed start]
start :: FilePath -> (Key, Backend) -> CommandStart
start file (key, _) = do
link <- calcGitLink file key
stopUnless ((/=) link <$> liftIO (readSymbolicLink file)) $ do
stopUnless ((/=) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file)) $ do
showStart "fix" file
next $ perform file link