diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-07 14:10:21 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-07 14:10:34 -0400 |
commit | e1e52ab130e4a67d001e0577010f8cd142860914 (patch) | |
tree | 7f5346afa63d27de9b0c2013624a3e788402eb8f /Remote | |
parent | 536e5d9cc713d766690330668f6fb9b363d56d61 (diff) |
gcrypt: Support re-enabling to change eg, encryption parameters.
This was never supported before. And it doesn't re-encrypt the
gcrypt repo to the new gcrypt-participants, but it does at least now not
crash, and set gcrypt-participants.
This commit was sponsored by andrea rota.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/GCrypt.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs index ea101a770..f1b48cdd2 100644 --- a/Remote/GCrypt.hs +++ b/Remote/GCrypt.hs @@ -31,7 +31,6 @@ import qualified Git.Command import qualified Git.Config import qualified Git.GCrypt import qualified Git.Construct -import qualified Git.Types as Git () import qualified Annex.Branch import Config import Config.Cost @@ -176,11 +175,18 @@ gCryptSetup _ mu _ c gc = go $ M.lookup "gitrepo" c go Nothing = giveup "Specify gitrepo=" go (Just gitrepo) = do (c', _encsetup) <- encryptionSetup c gc - inRepo $ Git.Command.run - [ Param "remote", Param "add" - , Param remotename - , Param $ Git.GCrypt.urlPrefix ++ gitrepo - ] + + let url = Git.GCrypt.urlPrefix ++ gitrepo + rs <- fromRepo Git.remotes + case filter (\r -> Git.remoteName r == Just remotename) rs of + [] -> inRepo $ Git.Command.run + [ Param "remote", Param "add" + , Param remotename + , Param url + ] + (r:_) + | Git.repoLocation r == url -> noop + | otherwise -> error "Another remote with the same name already exists." setGcryptEncryption c' remotename |