dropunused behavior change: Now refuses to drop the last copy of a file, unless you use the --force.

This was the last place in git-annex that could remove data referred to by
the git history, without being forced.

Like drop, dropunused checks remotes, and honors the global annex.numcopies
setting. (However, .gitattributes settings cannot apply to unused files.)
This commit is contained in:
Joey Hess 2013-07-25 19:39:44 -04:00
parent b80ec22056
commit 822918089e
4 changed files with 11 additions and 5 deletions

View file

@ -32,9 +32,8 @@ perform key = maybe droplocal dropremote =<< Remote.byNameWithUUID =<< from
where
dropremote r = do
showAction $ "from " ++ Remote.name r
ok <- Remote.removeKey r key
next $ Command.Drop.cleanupRemote key r ok
droplocal = Command.Drop.performLocal key (Just 0) Nothing -- force drop
Command.Drop.performRemote key Nothing r
droplocal = Command.Drop.performLocal key Nothing Nothing
from = Annex.getField $ Option.name Command.Drop.fromOption
performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform