summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-04-07 13:51:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-04-07 13:51:09 -0400
commit536e5d9cc713d766690330668f6fb9b363d56d61 (patch)
treed18b34791cbbcc71697aa1ab0ed36013cdd23cca /Command
parent4a332477b2a7cf56a6c71e4847c3a0a7bc721d41 (diff)
enableremote: Fix re-enabling of existing gcrypt remotes, so that eg, encryption key changes take effect.
They were silently ignored, a reversion introduced in 6.20160527. I don't like this regular git remote special case in enableremote, but I can't see a way to get rid of it. So, check if the existing remote is a Remote.Git This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'Command')
-rw-r--r--Command/EnableRemote.hs33
1 files changed, 21 insertions, 12 deletions
diff --git a/Command/EnableRemote.hs b/Command/EnableRemote.hs
index 3addd87d7..b9b53a69c 100644
--- a/Command/EnableRemote.hs
+++ b/Command/EnableRemote.hs
@@ -39,19 +39,28 @@ start (name:rest) = go =<< filter matchingname <$> Annex.fromRepo Git.remotes
matchingname r = Git.remoteName r == Just name
go [] = startSpecialRemote name (Logs.Remote.keyValToConfig rest)
=<< Annex.SpecialRemote.findExisting name
- go (r:_)
- | null rest = startNormalRemote name r
- | otherwise = giveup $
- "That is a normal git remote; passing these parameters does not make sense: " ++ unwords rest
+ go (r:_) = do
+ -- This could be either a normal git remote or a special
+ -- remote that has an url (eg gcrypt).
+ rs <- Remote.remoteList
+ case filter (\rmt -> Remote.name rmt == name) rs of
+ (rmt:_) | Remote.remotetype rmt == Remote.Git.remote ->
+ startNormalRemote name rest r
+ _ -> go []
-startNormalRemote :: Git.RemoteName -> Git.Repo -> CommandStart
-startNormalRemote name r = do
- showStart "enableremote" name
- next $ next $ do
- setRemoteIgnore r False
- r' <- Remote.Git.configRead False r
- u <- getRepoUUID r'
- return $ u /= NoUUID
+-- Normal git remotes are special-cased; enableremote retries probing
+-- the remote uuid.
+startNormalRemote :: Git.RemoteName -> [String] -> Git.Repo -> CommandStart
+startNormalRemote name restparams r
+ | null restparams = do
+ showStart "enableremote" name
+ next $ next $ do
+ setRemoteIgnore r False
+ r' <- Remote.Git.configRead False r
+ u <- getRepoUUID r'
+ return $ u /= NoUUID
+ | otherwise = giveup $
+ "That is a normal git remote; passing these parameters does not make sense: " ++ unwords restparams
startSpecialRemote :: Git.RemoteName -> Remote.RemoteConfig -> Maybe (UUID, Remote.RemoteConfig) -> CommandStart
startSpecialRemote name config Nothing = do