Quellcode durchsuchen

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 <dpursehouse@collab.net>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Mike Frysinger vor 6 Jahren
Ursprung
Commit
7936ce8677
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      subcmds/init.py

+ 8 - 0
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')