rethought --relaxed change

Better to make it not be surprising and slow, than surprising and fast.
--raw can be used when it needs to be really fast.

Implemented adding a youtube-dl supported url to an existing file.

This commit was sponsored by andrea rota.
This commit is contained in:
Joey Hess 2017-11-30 13:45:43 -04:00
parent 8a0038ec23
commit 2528e3ddb0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 75 additions and 84 deletions

View file

@ -1017,10 +1017,10 @@ pruneTmpWorkDirBefore f action = do
{- Runs an action, passing it a temporary work directory where
- it can write files while receiving the content of a key.
-
- On exception, or when the action returns a Left value,
- On exception, or when the action returns Nothing,
- the temporary work directory is left, so resumes can use it.
-}
withTmpWorkDir :: Key -> (FilePath -> Annex (Either a b)) -> Annex (Either a b)
withTmpWorkDir :: Key -> (FilePath -> Annex (Maybe a)) -> Annex (Maybe a)
withTmpWorkDir key action = do
-- Create the object file if it does not exist. This way,
-- staleKeysPrune only has to look for object files, and can
@ -1034,8 +1034,8 @@ withTmpWorkDir key action = do
setAnnexDirPerm tmpdir
res <- action tmpdir
case res of
Right _ -> liftIO $ removeDirectoryRecursive tmpdir
Left _ -> noop
Just _ -> liftIO $ removeDirectoryRecursive tmpdir
Nothing -> noop
return res
{- Finds items in the first, smaller list, that are not