summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-08-27 01:50:12 -0400
committerMike Frysinger <vapier@google.com>2020-09-02 07:53:16 +0000
commit0578ebf61a6269e4045153c7d618baebaf00d869 (patch)
tree58c6b2b7679a40143178dd4126932f42ed3b5afa /subcmds/init.py
parent65f51ad29b69986148a3eebd58683f0c4755d10a (diff)
downloadgit-repo-0578ebf61a6269e4045153c7d618baebaf00d869.tar.gz
init: reject unknown args
If you pass args to `repo init` when first creating a checkout, the repo launcher throws an error. But the init subcommand that runs in an existing checkout silently ignores them. Throw a proper error. Change-Id: I433bfcc73902d25f6b6a2974e77f6a977a75ed16 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/279696 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index eb82e2e4..41578076 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -488,6 +488,9 @@ to update the working directory files.
488 if opt.archive and opt.mirror: 488 if opt.archive and opt.mirror:
489 self.OptionParser.error('--mirror and --archive cannot be used together.') 489 self.OptionParser.error('--mirror and --archive cannot be used together.')
490 490
491 if args:
492 self.OptionParser.error('init takes no arguments')
493
491 def Execute(self, opt, args): 494 def Execute(self, opt, args):
492 git_require(MIN_GIT_VERSION_HARD, fail=True) 495 git_require(MIN_GIT_VERSION_HARD, fail=True)
493 if not git_require(MIN_GIT_VERSION_SOFT): 496 if not git_require(MIN_GIT_VERSION_SOFT):