project: Add REPO_PROJECT_FETCH_URL environment variable

Add REPO_PROJECT_FETCH_URL to Project.GetEnvVars(), which resolves to
the remote fetch URL of the project. This is useful for exposing the
URL to custom fetch commands or other external scripts.

Bug: 513329573
Change-Id: Ic2b0a83493934d16bb1152366ee4e1a2c35ea2dc
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/596121
Tested-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak
2026-06-15 23:22:53 +00:00
committed by gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 4b462634e0
commit cd307a6089
4 changed files with 8 additions and 0 deletions
+3
View File
@@ -1060,6 +1060,9 @@ class GetEnvVarsTests(unittest.TestCase):
self.assertEqual(env["REPO_RREV"], "main")
self.assertEqual(env["REPO_UPSTREAM"], "upstream-branch")
self.assertEqual(env["REPO_DEST_BRANCH"], "dest-branch")
self.assertEqual(
env["REPO_PROJECT_FETCH_URL"], "http://example.com/repo"
)
def test_get_env_vars_non_local(self):
"""Test environment variables generation with local=False."""