assistant: Avoid trying to drop content from remotes that don't have it.

This commit is contained in:
Joey Hess 2012-12-05 12:44:08 -04:00
parent 2b31aec3ee
commit c59783a549
3 changed files with 13 additions and 1 deletions

View file

@ -11,7 +11,7 @@ import Assistant.Common
import Assistant.DaemonStatus import Assistant.DaemonStatus
import Logs.Location import Logs.Location
import Logs.Trust import Logs.Trust
import Types.Remote (AssociatedFile) import Types.Remote (AssociatedFile, uuid)
import qualified Remote import qualified Remote
import qualified Command.Drop import qualified Command.Drop
import Command import Command
@ -19,6 +19,8 @@ import Annex.Wanted
import Annex.Exception import Annex.Exception
import Config import Config
import qualified Data.Set as S
{- Drop from local and/or remote when allowed by the preferred content and {- Drop from local and/or remote when allowed by the preferred content and
- numcopies settings. -} - numcopies settings. -}
handleDrops :: Bool -> Key -> AssociatedFile -> Maybe Remote -> Assistant () handleDrops :: Bool -> Key -> AssociatedFile -> Maybe Remote -> Assistant ()
@ -29,6 +31,10 @@ handleDrops fromhere key f knownpresentremote = do
locs <- loggedLocations key locs <- loggedLocations key
handleDropsFrom locs syncrs fromhere key f knownpresentremote handleDropsFrom locs syncrs fromhere key f knownpresentremote
{- The UUIDs are ones where the content is believed to be present.
- The Remote list can include other remotes that do not have the content;
- only ones that match the UUIDs will be dropped from.
- If allows to drop fromhere, that drop will be tried first. -}
handleDropsFrom :: [UUID] -> [Remote] -> Bool -> Key -> AssociatedFile -> Maybe Remote -> Annex () handleDropsFrom :: [UUID] -> [Remote] -> Bool -> Key -> AssociatedFile -> Maybe Remote -> Annex ()
handleDropsFrom _ _ _ _ Nothing _ = noop handleDropsFrom _ _ _ _ Nothing _ = noop
handleDropsFrom locs rs fromhere key (Just f) knownpresentremote handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
@ -48,6 +54,7 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
go [] _ = noop go [] _ = noop
go (r:rest) n go (r:rest) n
| uuid r `S.notMember` slocs = go rest n
| checkcopies n = dropr r n >>= go rest | checkcopies n = dropr r n >>= go rest
| otherwise = noop | otherwise = noop
@ -66,3 +73,5 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
Command.Drop.startRemote f numcopies key r Command.Drop.startRemote f numcopies key r
safely a = either (const False) id <$> tryAnnex a safely a = either (const False) id <$> tryAnnex a
slocs = S.fromList locs

1
debian/changelog vendored
View file

@ -20,6 +20,7 @@ git-annex (3.20121128) UNRELEASED; urgency=low
* webapp: Added help buttons and links next to fields that require * webapp: Added help buttons and links next to fields that require
explanations. explanations.
* webapp: Encryption can be disabled when setting up remotes. * webapp: Encryption can be disabled when setting up remotes.
* assistant: Avoid trying to drop content from remotes that don't have it.
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400 -- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400

View file

@ -1,3 +1,5 @@
I am running 3.20121112 and this bug appeared when I upgraded to that from 3.20121017. I am running 3.20121112 and this bug appeared when I upgraded to that from 3.20121017.
After performing the startup scan after I login, git-annex gets GPG to sends me a pinentry pop-up asking for my GPG passphrase. However, I know that there is nothing to be dropped or copied to the encrypted SSH remote that I am being asked to provide access to. So I can't see any good reason why I would be asked for the passphrase. After performing the startup scan after I login, git-annex gets GPG to sends me a pinentry pop-up asking for my GPG passphrase. However, I know that there is nothing to be dropped or copied to the encrypted SSH remote that I am being asked to provide access to. So I can't see any good reason why I would be asked for the passphrase.
> [[fixed|done]] --[[Joey]]