summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs9
-rw-r--r--Command/Indirect.hs12
-rw-r--r--Command/Reinject.hs3
3 files changed, 13 insertions, 11 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 169875f4b..a89a25e83 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -356,10 +356,13 @@ cleanup u url file key mtmp = case mtmp of
where
go = do
maybeShowJSON $ JSONChunk [("key", key2file key)]
- when (isJust mtmp) $
- logStatus key InfoPresent
setUrlPresent u key url
- addAnnexedFile file key mtmp
+ ifM (addAnnexedFile file key mtmp)
+ ( do
+ when (isJust mtmp) $
+ logStatus key InfoPresent
+ , liftIO $ maybe noop nukeFile mtmp
+ )
nodownload :: URLString -> Url.UrlInfo -> FilePath -> Annex (Maybe Key)
nodownload url urlinfo file
diff --git a/Command/Indirect.hs b/Command/Indirect.hs
index f12f9e59e..862c6e00e 100644
--- a/Command/Indirect.hs
+++ b/Command/Indirect.hs
@@ -86,16 +86,16 @@ perform = do
whenM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f) $ do
v <- tryNonAsync (moveAnnex k f)
case v of
- Right _ -> do
+ Right True -> do
l <- calcRepo $ gitAnnexLink f k
liftIO $ createSymbolicLink l f
- Left e -> catchNonAsync (restoreFile f k e)
- warnlocked
+ Right False -> warnlocked "Failed to move file to annex"
+ Left e -> catchNonAsync (restoreFile f k e) $
+ warnlocked . show
showEndOk
- warnlocked :: SomeException -> Annex ()
- warnlocked e = do
- warning $ show e
+ warnlocked msg = do
+ warning msg
warning "leaving this file as-is; correct this problem and run git annex add on it"
cleanup :: CommandCleanup
diff --git a/Command/Reinject.hs b/Command/Reinject.hs
index 8fe7587fa..48f50d324 100644
--- a/Command/Reinject.hs
+++ b/Command/Reinject.hs
@@ -74,9 +74,8 @@ perform src key = ifM move
, error "failed"
)
where
- move = checkDiskSpaceToGet key False $ do
+ move = checkDiskSpaceToGet key False $
moveAnnex key src
- return True
cleanup :: Key -> CommandCleanup
cleanup key = do