From: Joey Hess Date: Thu, 3 Dec 2015 19:58:00 +0000 (-0400) Subject: dropunused: Make more robust when trying to drop an object that has already been... X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~322^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=37a5e2d419abb732ce5f4fcbfe94dd2b918ab39c;p=git-annex.git 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. --- diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs index 9c2ae972a5..d9f02a370f 100644 --- a/Command/DropUnused.hs +++ b/Command/DropUnused.hs @@ -14,6 +14,7 @@ import qualified Remote import qualified Git import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused) import Annex.NumCopies +import Annex.Content cmd :: Command cmd = command "dropunused" SectionMaintenance @@ -37,14 +38,20 @@ seek o = do withUnusedMaps (start from numcopies) (rangesToDrop o) 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 from numcopies key = case from of Just r -> do showAction $ "from " ++ Remote.name 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 filespec key = do diff --git a/debian/changelog b/debian/changelog index ea54b99b4e..fae4b598b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ git-annex (5.20151117) UNRELEASED; urgency=medium being written to ~/.config/git-annex/autostart, and ignore any such relative paths in the file. 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 Mon, 16 Nov 2015 16:49:34 -0400