From fe5e25eec71f2fce631cb69dad04ead669d8ab8c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 15 Oct 2014 15:47:49 -0400 Subject: [PATCH] initremote: Don't allow creating a special remote that has the same name as an existing git remote. This is not a complete fix. For one, git remote will happily go add a remote that has the same name as an existing special remote. For another, enableremote will enable a special remote over top of an existing git remote. And, also, the webapp might. --- Command/InitRemote.hs | 12 ++++++++---- debian/changelog | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index e2fc4146d8..51ea153731 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -33,11 +33,15 @@ start (name:ws) = ifM (isJust <$> findExisting name) ( error $ "There is already a special remote named \"" ++ name ++ "\". (Use enableremote to enable an existing special remote.)" , do - let c = newConfig name - t <- findType config + ifM (isJust <$> Remote.byNameOnly name) + ( error $ "There is already a remote named \"" ++ name ++ "\"" + , do + let c = newConfig name + t <- findType config - showStart "initremote" name - next $ perform t name $ M.union config c + showStart "initremote" name + next $ perform t name $ M.union config c + ) ) where config = Logs.Remote.keyValToConfig ws diff --git a/debian/changelog b/debian/changelog index 911b970493..4fafd331aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ git-annex (5.20141014) UNRELEASED; urgency=medium before it has no effect. * Remove hurd stuff from cabal file, since hackage currently rejects it. + * initremote: Don't allow creating a special remote that has the same + name as an existing git remote. -- Joey Hess Tue, 14 Oct 2014 14:09:24 -0400