fix --from overriding annex-ignore

Make git-annex get/copy/move --from foo override configuration of
remote.foo.annex-ignore, as documented.

This already worked for remotes supporting hasKeyCheap. For others though,
git-annex copy --from foo would silently not do anything, while
git-annex copy --to foo would use the annex-ignored remote.

Also improved the annex-ignore docs, to reflect that `git-annex get`
without --from will skip using annex-ignored remotes, for example.

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2023-11-30 15:11:57 -04:00
commit 1654572bc1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 32 additions and 18 deletions

View file

@ -51,7 +51,7 @@ check :: String -> Maybe Remote -> Annex Result
check ks mr = case mr of
Just r -> go Nothing [r]
Nothing -> do
mostlikely <- Remote.keyPossibilities k
mostlikely <- Remote.keyPossibilities (Remote.IncludeIgnored False) k
otherremotes <- flip Remote.remotesWithoutUUID
(map Remote.uuid mostlikely)
<$> remoteList

View file

@ -87,7 +87,8 @@ perform key afile = stopUnless (getKey key afile) $
{- Try to find a copy of the file in one of the remotes,
- and copy it to here. -}
getKey :: Key -> AssociatedFile -> Annex Bool
getKey key afile = getKey' key afile =<< Remote.keyPossibilities key
getKey key afile = getKey' key afile
=<< Remote.keyPossibilities (Remote.IncludeIgnored False) key
getKey' :: Key -> AssociatedFile -> [Remote] -> Annex Bool
getKey' key afile = dispatch

View file

@ -146,7 +146,7 @@ toStart' dest removewhen afile key ai si = do
expectedPresent :: Remote -> Key -> Annex Bool
expectedPresent dest key = do
remotes <- Remote.keyPossibilities key
remotes <- Remote.keyPossibilities (Remote.IncludeIgnored True) key
return $ dest `elem` remotes
toPerform :: Remote -> RemoveWhen -> Key -> AssociatedFile -> Bool -> Either String Bool -> CommandPerform
@ -249,7 +249,7 @@ fromOk src key
where
checklog = do
u <- getUUID
remotes <- Remote.keyPossibilities key
remotes <- Remote.keyPossibilities (Remote.IncludeIgnored True) key
return $ u /= Remote.uuid src && elem src remotes
fromPerform :: Remote -> RemoveWhen -> Key -> AssociatedFile -> CommandPerform
@ -326,7 +326,7 @@ fromDrop src destuuid deststartedwithcopy key afile adjusttocheck =
toHereStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> SeekInput -> CommandStart
toHereStart removewhen afile key ai si =
startingNoMessage (OnlyActionOn key ai) $ do
rs <- Remote.keyPossibilities key
rs <- Remote.keyPossibilities (Remote.IncludeIgnored False) key
forM_ rs $ \r ->
includeCommandAction $
starting (describeMoveAction removewhen) ai si $

View file

@ -897,7 +897,7 @@ seekSyncContent o rs currbranch = do
syncFile :: SyncOptions -> Either (Maybe (Bloom Key)) (Key -> Annex ()) -> [Remote] -> AssociatedFile -> Key -> Annex Bool
syncFile o ebloom rs af k = do
inhere <- inAnnex k
locs <- map Remote.uuid <$> Remote.keyPossibilities k
locs <- map Remote.uuid <$> Remote.keyPossibilities (Remote.IncludeIgnored False) k
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
got <- anyM id =<< handleget have inhere