From 7936ce867707658929df8b234ff3449dea4d4a0a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 29 Feb 2020 02:53:41 -0500 Subject: [PATCH] init: respect --repo-url changes We respect this option when running the first `repo init`, but then silently ignore it once the initial sync is done. Make sure users are able to change things on the fly. Bug: https://crbug.com/gerrit/11045 Change-Id: I129ec5fec43a85067d555bb60c0d1ae02465f139 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258893 Tested-by: David Pursehouse Reviewed-by: David Pursehouse --- subcmds/init.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subcmds/init.py b/subcmds/init.py index 2003006..94bd44c 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -490,6 +490,14 @@ to update the working directory files. opt.quiet = opt.output_mode is False opt.verbose = opt.output_mode is True + rp = self.manifest.repoProject + + # Handle new --repo-url requests. + if opt.repo_url: + remote = rp.GetRemote('origin') + remote.url = opt.repo_url + remote.Save() + if opt.worktree: # Older versions of git supported worktree, but had dangerous gc bugs. git_require((2, 15, 0), fail=True, msg='git gc worktree corruption')