diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-27 19:10:10 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-27 19:11:00 -0400 |
commit | 33e18d3d02865ac0677fc1f22de2352b92f184a8 (patch) | |
tree | 3c25c3e19f45faee23fe5a3b445966c18cbc6c5a /Command/Drop.hs | |
parent | f66f97c90e5692ab34cb95e6facdec194a72456b (diff) |
cleanup
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r-- | Command/Drop.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index 02f44915c..a84d2efcc 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -23,8 +23,6 @@ command = [Command "drop" paramPaths defaultChecks seek seek :: [CommandSeek] seek = [withNumCopies start] -{- Indicates a file's content is not wanted anymore, and should be removed - - if it's safe to do so. -} start :: FilePath -> Maybe Int -> CommandStart start file numcopies = isAnnexed file $ \(key, _) -> do present <- inAnnex key @@ -36,7 +34,7 @@ start file numcopies = isAnnexed file $ \(key, _) -> do perform :: Key -> Maybe Int -> CommandPerform perform key numcopies = do - success <- dropKey key numcopies + success <- canDropKey key numcopies if success then next $ cleanup key else stop @@ -48,10 +46,9 @@ cleanup key = do return True {- Checks remotes to verify that enough copies of a key exist to allow - - for a key to be safely removed (with no data loss), and fails with an - - error if not. -} -dropKey :: Key -> Maybe Int -> Annex Bool -dropKey key numcopiesM = do + - for a key to be safely removed (with no data loss). -} +canDropKey :: Key -> Maybe Int -> Annex Bool +canDropKey key numcopiesM = do force <- Annex.getState Annex.force if force || numcopiesM == Just 0 then return True |