From 12214400154a979da1470447dd7a770b8b90b6f5 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 28 Feb 2025 10:47:01 -0800 Subject: [PATCH] roll_dep_test: remove file:// scheme in the git url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit roll_dep_test is currently using file:///path/to/repo as git url. Interestingly, the test is not failing in presubmit bot but failing locally because it is trying to clone using sso protocol (see: b/391455129#comment11). I think the presubmit bot is not equipped with git-remote-sso so the tests are able to pass. However, on a local workstation, git-remote-sso is available but it should not be used as the file:// scheme should indicate using local transport protocol. Quoted from https://git-scm.com/docs/git-clone#_git_urls > When Git doesn’t know how to handle a certain transport protocol, it attempts to use the remote- remote helper, if one exists. Removing the file:// scheme appears to fix the issue even though the only difference is the usage of --local flag according to the doc. fwiw, I did try to inject `--local` flag but it gives me a warning `--local is ignored`. I haven't dig deep enough to figure out why the flag is ignored. Bug: 391455129 Change-Id: I8fab9aee5198b2eedfacdb60161197b58f7533ea Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313297 Commit-Queue: Josip Sokcevic Reviewed-by: Josip Sokcevic Auto-Submit: Yiwei Zhang --- tests/roll_dep_test.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/roll_dep_test.py b/tests/roll_dep_test.py index 462474de5..ba16d0814 100755 --- a/tests/roll_dep_test.py +++ b/tests/roll_dep_test.py @@ -41,7 +41,7 @@ class FakeRepos(fake_repos.FakeReposBase): 'repo_1', { 'DEPS': '\n'.join([ 'deps = {', - ' "src/foo": "file://%(git_base)srepo_2@%(repo_2_revision)s",', + ' "src/foo": "%(git_base)srepo_2@%(repo_2_revision)s",', '}', 'hooks = [', ' {"action": ["foo", "--android", "{checkout_android}"]}', @@ -71,11 +71,9 @@ class RollDepTest(fake_repos.FakeReposTestBase): self.src_dir = os.path.join(self.root_dir, 'src') self.foo_dir = os.path.join(self.src_dir, 'foo') if self.enabled: - self.call([ - GCLIENT, 'config', 'file://' + self.git_base + 'repo_1', - '--name', 'src' - ], - cwd=self.root_dir) + self.call( + [GCLIENT, 'config', self.git_base + 'repo_1', '--name', 'src'], + cwd=self.root_dir) self.call([GCLIENT, 'sync'], cwd=self.root_dir) def call(self, cmd, cwd=None): @@ -110,8 +108,8 @@ class RollDepTest(fake_repos.FakeReposTestBase): self.assertEqual(self.gitrevparse(self.foo_dir), expected_revision) self.assertEqual([ 'deps = {', - ' "src/foo": "file://' + self.git_base.replace('\\', '\\\\') + - 'repo_2@' + expected_revision + '",', + ' "src/foo": "' + self.git_base.replace('\\', '\\\\') + 'repo_2@' + + expected_revision + '",', '}', 'hooks = [', ' {"action": ["foo", "--android", "{checkout_android}"]}', @@ -159,8 +157,8 @@ class RollDepTest(fake_repos.FakeReposTestBase): self.assertEqual(self.gitrevparse(self.foo_dir), expected_revision) self.assertEqual([ 'deps = {', - ' "src/foo": "file://' + self.git_base.replace('\\', '\\\\') + - 'repo_2@' + expected_revision + '",', + ' "src/foo": "' + self.git_base.replace('\\', '\\\\') + 'repo_2@' + + expected_revision + '",', '}', 'hooks = [', ' {"action": ["foo", "--android", "{checkout_android}"]}', @@ -191,8 +189,8 @@ class RollDepTest(fake_repos.FakeReposTestBase): self.assertEqual(self.gitrevparse(self.foo_dir), expected_revision) self.assertEqual([ 'deps = {', - ' "src/foo": "file://' + self.git_base.replace('\\', '\\\\') + - 'repo_2@' + expected_revision + '",', + ' "src/foo": "' + self.git_base.replace('\\', '\\\\') + 'repo_2@' + + expected_revision + '",', '}', 'hooks = [', ' {"action": ["foo", "--android", "{checkout_android}"]}',