Permit - in URL schemes for special URLs

Clients might be using their own special git-remote-* helper that
has a hypen in its name. Permit - in the scheme part of the URL
when trying to decide if it is an SSH URL and assume it is *not*
SSH if the URL matches "foo-bar://" style.

Change-Id: I7ba2d810a614f6e605a441d5972902c4a14e73fd
This commit is contained in:
Shawn O. Pearce 2012-03-14 15:22:28 -07:00
parent ae0a36c9a5
commit 898e12a2d9
2 changed files with 3 additions and 1 deletions

View File

@ -488,7 +488,7 @@ def close_ssh():
_master_keys_lock = None _master_keys_lock = None
URI_SCP = re.compile(r'^([^@:]*@?[^:/]{1,}):') URI_SCP = re.compile(r'^([^@:]*@?[^:/]{1,}):')
URI_ALL = re.compile(r'^([a-z][a-z+]*)://([^@/]*@?[^/]*)/') URI_ALL = re.compile(r'^([a-z][a-z+-]*)://([^@/]*@?[^/]*)/')
def GetSchemeFromUrl(url): def GetSchemeFromUrl(url):
m = URI_ALL.match(url) m = URI_ALL.match(url)

View File

@ -1449,6 +1449,8 @@ class Project(object):
remote = self.GetRemote(self.remote.name) remote = self.GetRemote(self.remote.name)
bundle_url = remote.url + '/clone.bundle' bundle_url = remote.url + '/clone.bundle'
bundle_url = GitConfig.ForUser().UrlInsteadOf(bundle_url) bundle_url = GitConfig.ForUser().UrlInsteadOf(bundle_url)
if GetSchemeFromUrl(bundle_url) in ('persistent-http', 'persistent-https'):
bundle_url = bundle_url[len('persistent-'):]
if GetSchemeFromUrl(bundle_url) not in ('http', 'https'): if GetSchemeFromUrl(bundle_url) not in ('http', 'https'):
return False return False