fix UI when enabling existing gcrypt repo
avoid editing repo for same reasons as in
52601eb606
avoid stomping on its description, even though no description exists until
after syncing is complete
This commit is contained in:
parent
c92d43fb7b
commit
4f7f61e46e
2 changed files with 13 additions and 8 deletions
|
@ -90,19 +90,23 @@ enableSpecialRemote name remotetype mcreds config = do
|
||||||
r <- Command.InitRemote.findExisting name
|
r <- Command.InitRemote.findExisting name
|
||||||
case r of
|
case r of
|
||||||
Nothing -> error $ "Cannot find a special remote named " ++ name
|
Nothing -> error $ "Cannot find a special remote named " ++ name
|
||||||
Just (u, c) -> setupSpecialRemote name remotetype config mcreds (Just u, c)
|
Just (u, c) -> setupSpecialRemote' False name remotetype config mcreds (Just u, c)
|
||||||
|
|
||||||
setupSpecialRemote :: RemoteName -> RemoteType -> R.RemoteConfig -> Maybe CredPair -> (Maybe UUID, R.RemoteConfig) -> Annex RemoteName
|
setupSpecialRemote :: RemoteName -> RemoteType -> R.RemoteConfig -> Maybe CredPair -> (Maybe UUID, R.RemoteConfig) -> Annex RemoteName
|
||||||
setupSpecialRemote name remotetype config mcreds (mu, c) = do
|
setupSpecialRemote = setupSpecialRemote' True
|
||||||
|
|
||||||
|
setupSpecialRemote' :: Bool -> RemoteName -> RemoteType -> R.RemoteConfig -> Maybe CredPair -> (Maybe UUID, R.RemoteConfig) -> Annex RemoteName
|
||||||
|
setupSpecialRemote' setdesc name remotetype config mcreds (mu, c) = do
|
||||||
{- Currently, only 'weak' ciphers can be generated from the
|
{- Currently, only 'weak' ciphers can be generated from the
|
||||||
- assistant, because otherwise GnuPG may block once the entropy
|
- assistant, because otherwise GnuPG may block once the entropy
|
||||||
- pool is drained, and as of now there's no way to tell the user
|
- pool is drained, and as of now there's no way to tell the user
|
||||||
- to perform IO actions to refill the pool. -}
|
- to perform IO actions to refill the pool. -}
|
||||||
(c', u) <- R.setup remotetype mu mcreds $
|
(c', u) <- R.setup remotetype mu mcreds $
|
||||||
M.insert "highRandomQuality" "false" $ M.union config c
|
M.insert "highRandomQuality" "false" $ M.union config c
|
||||||
whenM (isNothing . M.lookup u <$> uuidMap) $
|
|
||||||
describeUUID u name
|
|
||||||
configSet u c'
|
configSet u c'
|
||||||
|
when setdesc $
|
||||||
|
whenM (isNothing . M.lookup u <$> uuidMap) $
|
||||||
|
describeUUID u name
|
||||||
return name
|
return name
|
||||||
|
|
||||||
{- Returns the name of the git remote it created. If there's already a
|
{- Returns the name of the git remote it created. If there's already a
|
||||||
|
|
|
@ -475,10 +475,11 @@ checkExistingGCrypt sshdata nope = checkGCryptRepoEncryption repourl nope nope $
|
||||||
|
|
||||||
{- Enables an existing gcrypt special remote. -}
|
{- Enables an existing gcrypt special remote. -}
|
||||||
enableGCrypt :: SshData -> RemoteName -> Handler Html
|
enableGCrypt :: SshData -> RemoteName -> Handler Html
|
||||||
enableGCrypt sshdata reponame =
|
enableGCrypt sshdata reponame = setupRemote postsetup Nothing Nothing mk
|
||||||
setupCloudRemote TransferGroup Nothing $
|
where
|
||||||
enableSpecialRemote reponame GCrypt.remote Nothing $ M.fromList
|
mk = enableSpecialRemote reponame GCrypt.remote Nothing $
|
||||||
[("gitrepo", genSshUrl sshdata)]
|
M.fromList [("gitrepo", genSshUrl sshdata)]
|
||||||
|
postsetup _ = redirect DashboardR
|
||||||
|
|
||||||
{- Combining with a gcrypt repository that may not be
|
{- Combining with a gcrypt repository that may not be
|
||||||
- known in remote.log, so probe the gcrypt repo. -}
|
- known in remote.log, so probe the gcrypt repo. -}
|
||||||
|
|
Loading…
Add table
Reference in a new issue