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.
This commit is contained in:
parent
0a142fdd83
commit
fe5e25eec7
2 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue