use sameas-name and sameas-uuid for sameas remotes

initremote --sameas=remotename sets sameas-name and sameas-uuid

Using sameas-name rather than name prevents old git-annex initremote
from enabling a sameas remote by name, since it would not handle it
correctly.
This commit is contained in:
Joey Hess 2019-10-10 12:32:05 -04:00
parent 17afefd63f
commit 97b499a4dc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 32 additions and 10 deletions

View file

@ -53,7 +53,11 @@ start o (name:ws) = ifM (isJust <$> findExisting name)
ifM (isJust <$> Remote.byNameOnly name)
( giveup $ "There is already a remote named \"" ++ name ++ "\""
, do
let c = newConfig name
sameasuuid <- maybe
(pure Nothing)
(Just . Sameas <$$> getParsed)
(sameas o)
let c = newConfig name sameasuuid
t <- either giveup return (findType config)
starting "initremote" (ActionItemOther (Just name)) $
perform t name $ M.union config c