diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-31 16:46:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-31 17:22:55 -0400 |
commit | 3d2a9f84051e9dc705ba4bb4828af691e479ae0e (patch) | |
tree | f99ff17d8fa860d1dcf2c8ebd8552e1e80bda8b3 /Command/Add.hs | |
parent | 00988bcf369671bdc3b78e95e3c2ae43f4835b1c (diff) |
cleanup
Diffstat (limited to 'Command/Add.hs')
-rw-r--r-- | Command/Add.hs | 15 |
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 |