diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index 4f3c2effb0..27b5a7242e 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -60,7 +60,7 @@ calcSyncRemotes = do return $ \dstatus -> dstatus { syncRemotes = syncable - , syncGitRemotes = filter Remote.gitSyncableRemote syncable + , syncGitRemotes = filter (Remote.gitSyncableRemoteType . Remote.remotetype) syncable , syncDataRemotes = dataremotes , exportRemotes = exportremotes , downloadRemotes = contentremotes diff --git a/CHANGELOG b/CHANGELOG index 19c175852b..f577afa4e5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ git-annex (7.20200220) UNRELEASED; urgency=medium * Bugfix: export --tracking (a deprecated option) set annex-annex-tracking-branch, instead of annex-tracking-branch. + * initremote, enableremote: Set remote.name.skipFetchAll when + the remote cannot be fetched from by git, so git fetch --all + will not try to use it. -- Joey Hess Wed, 19 Feb 2020 12:48:58 -0400 diff --git a/Command/EnableRemote.hs b/Command/EnableRemote.hs index 976c180fdd..ab8999c36b 100644 --- a/Command/EnableRemote.hs +++ b/Command/EnableRemote.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2013-2019 Joey Hess + - Copyright 2013-2020 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -25,6 +25,7 @@ import Config import Config.DynamicConfig import Types.GitConfig import Types.ProposedAccepted +import Git.Config import qualified Data.Map as M @@ -86,10 +87,10 @@ startSpecialRemote name config (Just (u, c, mcu)) = performSpecialRemote :: RemoteType -> UUID -> R.RemoteConfig -> R.RemoteConfig -> RemoteGitConfig -> Maybe (SpecialRemote.ConfigFrom UUID) -> CommandPerform performSpecialRemote t u oldc c gc mcu = do (c', u') <- R.setup t (R.Enable oldc) (Just u) Nothing c gc - next $ cleanupSpecialRemote u' c' mcu + next $ cleanupSpecialRemote t u' c' mcu -cleanupSpecialRemote :: UUID -> R.RemoteConfig -> Maybe (SpecialRemote.ConfigFrom UUID) -> CommandCleanup -cleanupSpecialRemote u c mcu = do +cleanupSpecialRemote :: RemoteType -> UUID -> R.RemoteConfig -> Maybe (SpecialRemote.ConfigFrom UUID) -> CommandCleanup +cleanupSpecialRemote t u c mcu = do case mcu of Nothing -> Logs.Remote.configSet u c @@ -101,6 +102,8 @@ cleanupSpecialRemote u c mcu = do Just r -> do repo <- R.getRepo r setRemoteIgnore repo False + unless (Remote.gitSyncableRemoteType t) $ + setConfig (remoteConfig c "skipFetchAll") (boolConfig True) return True unknownNameError :: String -> Annex a diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index d954c033d7..c7b65c040c 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -23,6 +23,7 @@ import Logs.Remote import Types.GitConfig import Types.ProposedAccepted import Config +import Git.Config cmd :: Command cmd = command "initremote" SectionSetup @@ -87,7 +88,7 @@ perform t name c o = do dummycfg <- liftIO dummyRemoteGitConfig let c' = M.delete uuidField c (c'', u) <- R.setup t R.Init (sameasu <|> uuidfromuser) Nothing c' dummycfg - next $ cleanup u name c'' o + next $ cleanup t u name c'' o where uuidfromuser = case fromProposedAccepted <$> M.lookup uuidField c of Just s @@ -99,8 +100,8 @@ perform t name c o = do uuidField :: R.RemoteConfigField uuidField = Accepted "uuid" -cleanup :: UUID -> String -> R.RemoteConfig -> InitRemoteOptions -> CommandCleanup -cleanup u name c o = do +cleanup :: RemoteType -> UUID -> String -> R.RemoteConfig -> InitRemoteOptions -> CommandCleanup +cleanup t u name c o = do case sameas o of Nothing -> do describeUUID u (toUUIDDesc name) @@ -109,6 +110,8 @@ cleanup u name c o = do cu <- liftIO genUUID setConfig (remoteAnnexConfig c "config-uuid") (fromUUID cu) Logs.Remote.configSet cu c + unless (Remote.gitSyncableRemoteType t) $ + setConfig (remoteConfig c "skipFetchAll") (boolConfig True) return True describeOtherParamsFor :: RemoteConfig -> RemoteType -> CommandPerform diff --git a/Command/Sync.hs b/Command/Sync.hs index 2e6d4760f4..fe6f72c7dc 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -199,7 +199,7 @@ seek' o = do let withbranch a = a =<< getCurrentBranch remotes <- syncRemotes (syncWith o) - let gitremotes = filter Remote.gitSyncableRemote remotes + let gitremotes = filter (Remote.gitSyncableRemoteType . Remote.remotetype) remotes dataremotes <- filter (\r -> Remote.uuid r /= NoUUID) <$> filterM (not <$$> liftIO . getDynamicConfig . remoteAnnexIgnore . Remote.gitconfig) remotes let (exportremotes, keyvalueremotes) = partition (exportTree . Remote.config) dataremotes @@ -300,7 +300,7 @@ syncRemotes' ps available = listed = concat <$> mapM Remote.byNameOrGroup ps good r - | Remote.gitSyncableRemote r = + | Remote.gitSyncableRemoteType (Remote.remotetype r) = Remote.Git.repoAvail =<< Remote.getRepo r | otherwise = return True diff --git a/Remote.hs b/Remote.hs index 7066204c48..a1a07f95dc 100644 --- a/Remote.hs +++ b/Remote.hs @@ -24,7 +24,7 @@ module Remote ( remoteTypes, remoteList, remoteList', - gitSyncableRemote, + gitSyncableRemoteType, remoteMap, remoteMap', uuidDescriptions, diff --git a/Remote/List.hs b/Remote/List.hs index 4619df6345..82869b9aa8 100644 --- a/Remote/List.hs +++ b/Remote/List.hs @@ -128,8 +128,8 @@ updateRemote remote = do | otherwise = return r {- Checks if a remote is syncable using git. -} -gitSyncableRemote :: Remote -> Bool -gitSyncableRemote r = remotetype r `elem` +gitSyncableRemoteType :: RemoteType -> Bool +gitSyncableRemoteType t = t `elem` [ Remote.Git.remote , Remote.GCrypt.remote , Remote.P2P.remote