launcher: init: stop passing --repo-url/--repo-branch down

When the launcher handles the init subcommand, it takes care of
setting the repo url & branch itself when cloning.  So we don't
need to pass them down to the checked out init subcommand.

Further, the init subcommand has never actually done anything
with those options, so there's no point in passing them.

We'll be changing the latter behavior so that init will reset
the url/branch when specified with an existing repo checkout
which means passing them through adds overhead: the launcher
will checkout to the right value, then chain to the sub-init
which will then reset the checkout to the same value.

Bug: https://crbug.com/gerrit/11045
Change-Id: Ia2a4ab9d86febc470aea4abd73d75bb10e848b56
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259312
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
Mike Frysinger 2020-03-14 16:28:31 -04:00 committed by David Pursehouse
parent 7936ce8677
commit e1111f5710

14
repo
View File

@ -251,8 +251,6 @@ else:
home_dot_repo = os.path.expanduser('~/.repoconfig') home_dot_repo = os.path.expanduser('~/.repoconfig')
gpg_dir = os.path.join(home_dot_repo, 'gnupg') gpg_dir = os.path.join(home_dot_repo, 'gnupg')
extra_args = []
def GetParser(gitc_init=False): def GetParser(gitc_init=False):
"""Setup the CLI parser.""" """Setup the CLI parser."""
@ -474,15 +472,8 @@ def _Init(args, gitc_init=False):
opt.quiet = opt.output_mode is False opt.quiet = opt.output_mode is False
opt.verbose = opt.output_mode is True opt.verbose = opt.output_mode is True
url = opt.repo_url url = opt.repo_url or REPO_URL
if not url: branch = opt.repo_branch or REPO_REV
url = REPO_URL
extra_args.append('--repo-url=%s' % url)
branch = opt.repo_branch
if not branch:
branch = REPO_REV
extra_args.append('--repo-branch=%s' % branch)
if branch.startswith('refs/heads/'): if branch.startswith('refs/heads/'):
branch = branch[len('refs/heads/'):] branch = branch[len('refs/heads/'):]
@ -1105,7 +1096,6 @@ def main(orig_args):
'--wrapper-path=%s' % wrapper_path, '--wrapper-path=%s' % wrapper_path,
'--'] '--']
me.extend(orig_args) me.extend(orig_args)
me.extend(extra_args)
exec_command(me) exec_command(me)
print("fatal: unable to start %s" % repo_main, file=sys.stderr) print("fatal: unable to start %s" % repo_main, file=sys.stderr)
sys.exit(148) sys.exit(148)