aboutsummaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index cd18f6c72..a633db7b3 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -38,11 +38,10 @@ start p@(_, file) = notBareRepo $ notAnnexed file $ do
next $ perform p
perform :: BackendFile -> CommandPerform
-perform (backend, file) = do
- k <- Backend.genKey file backend
- case k of
- Nothing -> stop
- Just (key, _) -> do
+perform (backend, file) = Backend.genKey file backend >>= go
+ where
+ go Nothing = stop
+ go (Just (key, _)) = do
handle (undo file key) $ moveAnnex key file
next $ cleanup file key True
@@ -75,9 +74,9 @@ cleanup file key hascontent = do
-- touch the symlink to have the same mtime as the
-- file it points to
- s <- liftIO $ getFileStatus file
- let mtime = modificationTime s
- liftIO $ touch file (TimeSpec mtime) False
+ liftIO $ do
+ mtime <- modificationTime <$> getFileStatus file
+ touch file (TimeSpec mtime) False
force <- Annex.getState Annex.force
if force