From 342cd356664528516989b068886c439d58639cad Mon Sep 17 00:00:00 2001
From: Allen Li
Date: Thu, 7 Aug 2025 14:07:49 -0700
Subject: [PATCH] [git_auth] Add useHttpPath config for Gerrit auth
This is needed to pass the repo path to the credential helper, so we
can distinguish repos that need ReAuth.
Change-Id: I5aa72d6ec0421dcbff610f48f34129b8962050f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6822598
Reviewed-by: Gavin Mak
Commit-Queue: Allen Li
---
git_auth.py | 9 +
man/html/depot_tools_gerrit_auth.html | 5 +-
man/html/depot_tools_tutorial.html | 265 ++++++++++++--------------
man/man7/depot_tools_gerrit_auth.7 | 7 +-
man/man7/depot_tools_tutorial.7 | 247 +++++++++++-------------
man/src/depot_tools_gerrit_auth.txt | 1 +
tests/git_auth_test.py | 1 +
7 files changed, 253 insertions(+), 282 deletions(-)
diff --git a/git_auth.py b/git_auth.py
index 411dbb2bbd..7079ce7437 100644
--- a/git_auth.py
+++ b/git_auth.py
@@ -899,6 +899,10 @@ class ConfigWizard(object):
cred_key = _creds_helper_key(parts)
self._set_config(cred_key, '', modify_all=True, scope=scope)
self._set_config(cred_key, 'luci', append=True, scope=scope)
+ self._set_config(_creds_use_http_path_key(parts),
+ 'yes',
+ modify_all=True,
+ scope=scope)
def _set_sso_rewrite(self, parts: urllib.parse.SplitResult, *,
scope: scm.GitConfigScope) -> None:
@@ -1082,6 +1086,11 @@ def _creds_helper_key(parts: urllib.parse.SplitResult) -> str:
return f'credential.{_url_host_url(parts)}.helper'
+def _creds_use_http_path_key(parts: urllib.parse.SplitResult) -> str:
+ """Return Git config key for using path with helpers."""
+ return f'credential.{_url_host_url(parts)}.useHttpPath'
+
+
def _sso_rewrite_key(parts: urllib.parse.SplitResult) -> str:
"""Return Git config key for SSO URL rewrites."""
return f'url.sso://{_url_shortname(parts)}/.insteadOf'
diff --git a/man/html/depot_tools_gerrit_auth.html b/man/html/depot_tools_gerrit_auth.html
index 4ed8c8792a..cc1e78076b 100644
--- a/man/html/depot_tools_gerrit_auth.html
+++ b/man/html/depot_tools_gerrit_auth.html
@@ -778,7 +778,8 @@ creds-check), you can also do it manually.
[credential "https://chromium.googlesource.com"]
helper =
-helper = luci
+helper = luci
+useHttpPath = yes
This tells Git to use git-credential-luci. The first empty value
line is needed to reset the helper list to prevent conflicts.
@@ -812,7 +813,7 @@ by checking out the