summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Add.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 2453e6842..fa7d48544 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -56,12 +56,14 @@ start :: FilePath -> CommandStart
start file = ifAnnexed file addpresent add
where
add = do
- s <- liftIO $ getSymbolicLinkStatus file
- if isSymbolicLink s || not (isRegularFile s)
- then stop
- else do
- showStart "add" file
- next $ perform file
+ ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
+ case ms of
+ Nothing -> stop
+ Just s
+ | isSymbolicLink s || not (isRegularFile s) -> stop
+ | otherwise -> do
+ showStart "add" file
+ next $ perform file
addpresent (key, _) = ifM isDirect
( ifM (goodContent key file) ( stop , add )
, fixup key