renameremote: Better handling of case where there are multiple special remotes with a name

Instead of renaming one at random, error out and ask that a uuid be
specified.

Sponsored-by: Brett Eisenberg on Patreon
This commit is contained in:
Joey Hess 2022-01-05 15:24:02 -04:00
parent 58afb00f6e
commit e416635021
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 16 additions and 15 deletions

View file

@ -30,10 +30,10 @@ import qualified Data.Map as M
-
- Remotes that are not dead come first in the list
- when a name appears multiple times. -}
findExisting :: RemoteName -> Annex (Maybe (UUID, RemoteConfig, Maybe (ConfigFrom UUID)))
findExisting :: RemoteName -> Annex [(UUID, RemoteConfig, Maybe (ConfigFrom UUID))]
findExisting name = do
(a, b) <- findExisting' name
return (headMaybe (a++b))
return (a++b)
{- Dead remotes with the name are in the second list, all others in the
- first list. -}