dropunused: Make more robust when trying to drop an object that has already been dropped.
Before it crashed trying to lock the not-present content and prevented dropping anything else. Instead, succeed.
This commit is contained in:
parent
5e3e6b9ff9
commit
37a5e2d419
2 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,7 @@ import qualified Remote
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused)
|
import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused)
|
||||||
import Annex.NumCopies
|
import Annex.NumCopies
|
||||||
|
import Annex.Content
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = command "dropunused" SectionMaintenance
|
cmd = command "dropunused" SectionMaintenance
|
||||||
|
@ -37,14 +38,20 @@ seek o = do
|
||||||
withUnusedMaps (start from numcopies) (rangesToDrop o)
|
withUnusedMaps (start from numcopies) (rangesToDrop o)
|
||||||
|
|
||||||
start :: Maybe Remote -> NumCopies -> UnusedMaps -> Int -> CommandStart
|
start :: Maybe Remote -> NumCopies -> UnusedMaps -> Int -> CommandStart
|
||||||
start from numcopies = startUnused "dropunused" (perform from numcopies) (performOther gitAnnexBadLocation) (performOther gitAnnexTmpObjectLocation)
|
start from numcopies = startUnused "dropunused"
|
||||||
|
(perform from numcopies)
|
||||||
|
(performOther gitAnnexBadLocation)
|
||||||
|
(performOther gitAnnexTmpObjectLocation)
|
||||||
|
|
||||||
perform :: Maybe Remote -> NumCopies -> Key -> CommandPerform
|
perform :: Maybe Remote -> NumCopies -> Key -> CommandPerform
|
||||||
perform from numcopies key = case from of
|
perform from numcopies key = case from of
|
||||||
Just r -> do
|
Just r -> do
|
||||||
showAction $ "from " ++ Remote.name r
|
showAction $ "from " ++ Remote.name r
|
||||||
Command.Drop.performRemote key Nothing numcopies r
|
Command.Drop.performRemote key Nothing numcopies r
|
||||||
Nothing -> Command.Drop.performLocal key Nothing numcopies []
|
Nothing -> ifM (inAnnex key)
|
||||||
|
( Command.Drop.performLocal key Nothing numcopies []
|
||||||
|
, next (return True)
|
||||||
|
)
|
||||||
|
|
||||||
performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform
|
performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform
|
||||||
performOther filespec key = do
|
performOther filespec key = do
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -18,6 +18,8 @@ git-annex (5.20151117) UNRELEASED; urgency=medium
|
||||||
being written to ~/.config/git-annex/autostart, and ignore any such
|
being written to ~/.config/git-annex/autostart, and ignore any such
|
||||||
relative paths in the file.
|
relative paths in the file.
|
||||||
This was a reversion caused by the relative path changes in 5.20150113.
|
This was a reversion caused by the relative path changes in 5.20150113.
|
||||||
|
* dropunused: Make more robust when trying to drop an object that has
|
||||||
|
already been dropped.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2015 16:49:34 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2015 16:49:34 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue