repo: more arg checking for --standalone-manifest re-inits
`repo init` doesn't do anything on re-init when the checkout has
been initialized using --standalone manifest. Rather than let the
tool run through its existing flows (which happen to noop), check
the args and explicitly quit if a bare `repo init` is run on a
standalone checkout.
BUG=none
TEST=manual tests
Change-Id: Ie4346ef6df1282ec3e3f8045a08138c93653fece
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/320735
Tested-by: Jack Neus <jackneus@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
diff --git a/subcmds/init.py b/subcmds/init.py
index 53c6ba0..853cbe6 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -127,6 +127,11 @@
# anew.
if not is_new:
was_standalone_manifest = m.config.GetString('manifest.standalone')
+ if was_standalone_manifest and not opt.manifest_url:
+ print('fatal: repo was initialized with a standlone manifest, '
+ 'cannot be re-initialized without --manifest-url/-u')
+ sys.exit(1)
+
if opt.standalone_manifest or (
was_standalone_manifest and opt.manifest_url):
m.config.ClearCache()