mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Accept remote urls as gospel in git_cache.
git_cache rewrites all urls to https://netloc/path when setting them as remote urls. This doesn't work when the remote is actually local on disk, and the "url" is a /path/to/repo. This seems like an unlikely case, but it is leveraged by testing, and it doesn't hurt to support it, so now we do. R=iannucci@chromium.org BUG=261619 Review URL: https://codereview.chromium.org/196493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@256386 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
11
git_cache.py
11
git_cache.py
@@ -21,15 +21,6 @@ import subcommand
|
||||
GIT_EXECUTABLE = 'git.bat' if sys.platform.startswith('win') else 'git'
|
||||
|
||||
|
||||
def NormalizeUrl(url):
|
||||
"""Convert a git url to a normalized form."""
|
||||
parsed = urlparse.urlparse(url)
|
||||
norm_url = 'https://' + parsed.netloc + parsed.path
|
||||
if not norm_url.endswith('.git'):
|
||||
norm_url += '.git'
|
||||
return norm_url
|
||||
|
||||
|
||||
def UrlToCacheDir(url):
|
||||
"""Convert a git url to a normalized form for the cache dir path."""
|
||||
parsed = urlparse.urlparse(url)
|
||||
@@ -192,7 +183,7 @@ def CMDpopulate(parser, args):
|
||||
def _config(directory):
|
||||
RunGit(['config', 'core.deltaBaseCacheLimit', '2g'],
|
||||
cwd=directory)
|
||||
RunGit(['config', 'remote.origin.url', NormalizeUrl(url)],
|
||||
RunGit(['config', 'remote.origin.url', url],
|
||||
cwd=directory)
|
||||
RunGit(['config', '--replace-all', 'remote.origin.fetch',
|
||||
'+refs/heads/*:refs/heads/*'],
|
||||
|
||||
Reference in New Issue
Block a user