summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-03-14 16:28:31 -0400
committerDavid Pursehouse <dpursehouse@collab.net>2020-03-17 09:24:04 +0000
commite1111f5710acf16d91975a9ee5e2c9464730becf (patch)
treee4e5473bc89c9a78887cf073716471c79740eff4
parent7936ce867707658929df8b234ff3449dea4d4a0a (diff)
downloadgit-repo-e1111f5710acf16d91975a9ee5e2c9464730becf.tar.gz
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>
-rwxr-xr-xrepo14
1 files changed, 2 insertions, 12 deletions
diff --git a/repo b/repo
index 18694c53..c6a56c65 100755
--- a/repo
+++ b/repo
@@ -251,8 +251,6 @@ else:
251home_dot_repo = os.path.expanduser('~/.repoconfig') 251home_dot_repo = os.path.expanduser('~/.repoconfig')
252gpg_dir = os.path.join(home_dot_repo, 'gnupg') 252gpg_dir = os.path.join(home_dot_repo, 'gnupg')
253 253
254extra_args = []
255
256 254
257def GetParser(gitc_init=False): 255def GetParser(gitc_init=False):
258 """Setup the CLI parser.""" 256 """Setup the CLI parser."""
@@ -474,15 +472,8 @@ def _Init(args, gitc_init=False):
474 opt.quiet = opt.output_mode is False 472 opt.quiet = opt.output_mode is False
475 opt.verbose = opt.output_mode is True 473 opt.verbose = opt.output_mode is True
476 474
477 url = opt.repo_url 475 url = opt.repo_url or REPO_URL
478 if not url: 476 branch = opt.repo_branch or REPO_REV
479 url = REPO_URL
480 extra_args.append('--repo-url=%s' % url)
481
482 branch = opt.repo_branch
483 if not branch:
484 branch = REPO_REV
485 extra_args.append('--repo-branch=%s' % branch)
486 477
487 if branch.startswith('refs/heads/'): 478 if branch.startswith('refs/heads/'):
488 branch = branch[len('refs/heads/'):] 479 branch = branch[len('refs/heads/'):]
@@ -1105,7 +1096,6 @@ def main(orig_args):
1105 '--wrapper-path=%s' % wrapper_path, 1096 '--wrapper-path=%s' % wrapper_path,
1106 '--'] 1097 '--']
1107 me.extend(orig_args) 1098 me.extend(orig_args)
1108 me.extend(extra_args)
1109 exec_command(me) 1099 exec_command(me)
1110 print("fatal: unable to start %s" % repo_main, file=sys.stderr) 1100 print("fatal: unable to start %s" % repo_main, file=sys.stderr)
1111 sys.exit(148) 1101 sys.exit(148)