have init --version fail when repo is already initialized with other version
init: When the repo is already initialized, and --version requests a different version, error out rather than silently not changing the version.
This commit is contained in:
parent
65f34ffb4c
commit
70b71bf660
3 changed files with 15 additions and 0 deletions
|
@ -51,6 +51,12 @@ start os = starting "init" (ActionItemOther (Just $ initDesc os)) $
|
|||
|
||||
perform :: InitOptions -> CommandPerform
|
||||
perform os = do
|
||||
case initVersion os of
|
||||
Nothing -> noop
|
||||
Just wantversion -> getVersion >>= \case
|
||||
Just v | v /= wantversion ->
|
||||
giveup $ "This repository is already a initialized with version " ++ show (fromRepoVersion v) ++ ", not changing to requested version."
|
||||
_ -> noop
|
||||
initialize
|
||||
(if null (initDesc os) then Nothing else Just (initDesc os))
|
||||
(initVersion os)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue