automate remote.name.skipFetchAll
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.
This commit is contained in:
parent
69f2d1dd43
commit
79a0435b77
7 changed files with 22 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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 <id@joeyh.name> Wed, 19 Feb 2020 12:48:58 -0400
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2013-2019 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2013-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module Remote (
|
|||
remoteTypes,
|
||||
remoteList,
|
||||
remoteList',
|
||||
gitSyncableRemote,
|
||||
gitSyncableRemoteType,
|
||||
remoteMap,
|
||||
remoteMap',
|
||||
uuidDescriptions,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue