summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs40
1 files changed, 17 insertions, 23 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index d1b2fbc7d..638da101e 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -98,31 +98,25 @@ start file = do
)
where
go = ifAnnexed file addpresent add
- add = do
- ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
- case ms of
- Nothing -> stop
- Just s
- | not (isRegularFile s) && not (isSymbolicLink s) -> stop
- | otherwise -> do
- showStart "add" file
- next $ if isSymbolicLink s
- then next $ addFile file
- else perform file
+ add = liftIO (catchMaybeIO $ getSymbolicLinkStatus file) >>= \case
+ Nothing -> stop
+ Just s
+ | not (isRegularFile s) && not (isSymbolicLink s) -> stop
+ | otherwise -> do
+ showStart "add" file
+ next $ if isSymbolicLink s
+ then next $ addFile file
+ else perform file
addpresent key = ifM versionSupportsUnlockedPointers
- ( do
- ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
- case ms of
- Just s | isSymbolicLink s -> fixuplink key
- _ -> ifM (sameInodeCache file =<< Database.Keys.getInodeCaches key)
- ( stop, add )
+ ( liftIO (catchMaybeIO $ getSymbolicLinkStatus file) >>= \case
+ Just s | isSymbolicLink s -> fixuplink key
+ _ -> ifM (sameInodeCache file =<< Database.Keys.getInodeCaches key)
+ ( stop, add )
, ifM isDirect
- ( do
- ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
- case ms of
- Just s | isSymbolicLink s -> fixuplink key
- _ -> ifM (goodContent key file)
- ( stop , add )
+ ( liftIO (catchMaybeIO $ getSymbolicLinkStatus file) >>= \case
+ Just s | isSymbolicLink s -> fixuplink key
+ _ -> ifM (goodContent key file)
+ ( stop , add )
, fixuplink key
)
)