drop --auto: Fix bug that prevented dropping files from untrusted repositories.
This is a corresponding bug to the one I fixed yesterday in the assistant.
This commit is contained in:
parent
4b12506c0a
commit
d87af82d97
3 changed files with 24 additions and 22 deletions
21
Command.hs
21
Command.hs
|
@ -20,7 +20,6 @@ module Command (
|
|||
isBareRepo,
|
||||
numCopies,
|
||||
numCopiesCheck,
|
||||
autoCopiesWith,
|
||||
checkAuto,
|
||||
module ReExported
|
||||
) where
|
||||
|
@ -109,26 +108,6 @@ numCopiesCheck file key vs = do
|
|||
have <- trustExclude UnTrusted =<< Remote.keyLocations key
|
||||
return $ length have `vs` needed
|
||||
|
||||
{- Used for commands that have an auto mode that checks the number of known
|
||||
- copies of a key.
|
||||
-
|
||||
- In auto mode, first checks that the number of known
|
||||
- copies of the key is > or < than the numcopies setting, before running
|
||||
- the action.
|
||||
-}
|
||||
autoCopiesWith :: FilePath -> Key -> (Int -> Int -> Bool) -> (Maybe Int -> CommandStart) -> CommandStart
|
||||
autoCopiesWith file key vs a = do
|
||||
numcopiesattr <- numCopies file
|
||||
Annex.getState Annex.auto >>= auto numcopiesattr
|
||||
where
|
||||
auto numcopiesattr False = a numcopiesattr
|
||||
auto numcopiesattr True = do
|
||||
needed <- getNumCopies numcopiesattr
|
||||
have <- trustExclude UnTrusted =<< Remote.keyLocations key
|
||||
if length have `vs` needed
|
||||
then a numcopiesattr
|
||||
else stop
|
||||
|
||||
checkAuto :: Annex Bool -> Annex Bool
|
||||
checkAuto checker = ifM (Annex.getState Annex.auto)
|
||||
( checker , return True )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue