diff --git a/Annex/NumCopies.hs b/Annex/NumCopies.hs index a3c6f92dcd..1d8722a3d4 100644 --- a/Annex/NumCopies.hs +++ b/Annex/NumCopies.hs @@ -317,7 +317,7 @@ pluralCopies _ = "copies" verifiableCopies :: Key -> [UUID] -> Annex ([UnVerifiedCopy], [VerifiedCopy]) verifiableCopies key exclude = do locs <- Remote.keyLocations key - (remotes, trusteduuids) <- Remote.remoteLocations locs + (remotes, trusteduuids) <- Remote.remoteLocations (Remote.IncludeIgnored False) locs =<< trustGet Trusted untrusteduuids <- trustGet UnTrusted let exclude' = exclude ++ untrusteduuids diff --git a/Assistant/TransferQueue.hs b/Assistant/TransferQueue.hs index d2d245b7b1..571899bb6d 100644 --- a/Assistant/TransferQueue.hs +++ b/Assistant/TransferQueue.hs @@ -93,7 +93,7 @@ queueTransfersMatching matching reason schedule k f direction filter (\r -> not (inset s r || Remote.readonly r)) (syncDataRemotes st) where - locs = S.fromList . map Remote.uuid <$> Remote.keyPossibilities k + locs = S.fromList . map Remote.uuid <$> Remote.keyPossibilities (Remote.IncludeIgnored False) k inset s r = S.member (Remote.uuid r) s gentransfer r = Transfer { transferDirection = direction diff --git a/CHANGELOG b/CHANGELOG index e848250109..3fdedb9023 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +git-annex (10.20231130) UNRELEASED; urgency=medium + + * Make git-annex get/copy/move --from foo override configuration of + remote.foo.annex-ignore, as documented. + + -- Joey Hess Thu, 30 Nov 2023 14:48:12 -0400 + git-annex (10.20231129) upstream; urgency=medium * Fix bug in git-annex copy --from --to that skipped files that were diff --git a/Command/CheckPresentKey.hs b/Command/CheckPresentKey.hs index f3b4ef921c..efefc71aeb 100644 --- a/Command/CheckPresentKey.hs +++ b/Command/CheckPresentKey.hs @@ -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 diff --git a/Command/Get.hs b/Command/Get.hs index 7d3d4a2ef1..2dd48456f4 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -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 diff --git a/Command/Move.hs b/Command/Move.hs index 2e450b3e4a..59bdf9ecad 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -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 $ diff --git a/Command/Sync.hs b/Command/Sync.hs index fcdc807f1f..851776f95f 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -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 diff --git a/Remote.hs b/Remote.hs index 93b2e30f87..1638777277 100644 --- a/Remote.hs +++ b/Remote.hs @@ -47,6 +47,7 @@ module Remote ( remotesWithUUID, remotesWithoutUUID, keyLocations, + IncludeIgnored(..), keyPossibilities, remoteLocations, nameToUUID, @@ -299,13 +300,16 @@ remotesWithoutUUID rs us = filter (\r -> uuid r `notElem` us) rs keyLocations :: Key -> Annex [UUID] keyLocations key = trustExclude DeadTrusted =<< loggedLocations key +{- Whether to include remotes that have annex-ignore set. -} +newtype IncludeIgnored = IncludeIgnored Bool + {- Cost ordered lists of remotes that the location log indicates - may have a key. - - Also includes remotes with remoteAnnexSpeculatePresent set. -} -keyPossibilities :: Key -> Annex [Remote] -keyPossibilities key = do +keyPossibilities :: IncludeIgnored -> Key -> Annex [Remote] +keyPossibilities ii key = do u <- getUUID -- uuids of all remotes that are recorded to have the key locations <- filter (/= u) <$> keyLocations key @@ -315,19 +319,21 @@ keyPossibilities key = do -- there are unlikely to be many speclocations, so building a Set -- is not worth the expense let locations' = speclocations ++ filter (`notElem` speclocations) locations - fst <$> remoteLocations locations' [] + fst <$> remoteLocations ii locations' [] {- Given a list of locations of a key, and a list of all - trusted repositories, generates a cost-ordered list of - remotes that contain the key, and a list of trusted locations of the key. -} -remoteLocations :: [UUID] -> [UUID] -> Annex ([Remote], [UUID]) -remoteLocations locations trusted = do +remoteLocations :: IncludeIgnored -> [UUID] -> [UUID] -> Annex ([Remote], [UUID]) +remoteLocations (IncludeIgnored ii) locations trusted = do let validtrustedlocations = nub locations `intersect` trusted -- remotes that match uuids that have the key allremotes <- remoteList - >>= filterM (not <$$> liftIO . getDynamicConfig . remoteAnnexIgnore . gitconfig) + >>= if not ii + then filterM (not <$$> liftIO . getDynamicConfig . remoteAnnexIgnore . gitconfig) + else return let validremotes = remotesWithUUID allremotes locations return (sortBy (comparing cost) validremotes, validtrustedlocations) diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index dfcd600c49..750ad923f0 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -1388,9 +1388,9 @@ Remotes are configured using these settings in `.git/config`. * `remote..annex-ignore` - If set to `true`, prevents git-annex - from storing annexed file contents on this remote by default. - (You can still request it be used by the `--from` and `--to` options.) + If set to `true`, prevents git-annex from storing or retrieving annexed + file contents on this remote by default. + (You can still request it be used with the `--from` and `--to` options.) This is, for example, useful if the remote is located somewhere without git-annex-shell. (For example, if it's on GitHub). @@ -1399,7 +1399,7 @@ Remotes are configured using these settings in `.git/config`. This does not prevent `git-annex sync`, `git-annex pull`, `git-annex push`, `git-annex assist` or the `git-annex assistant` from operating on the - git repository. + git repository. It only affects annexed content. * `remote..annex-ignore-command`