diff options
| -rw-r--r-- | git_config.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git_config.py b/git_config.py index 163b0809..53b52c85 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -337,12 +337,9 @@ class RefSpec(object): | |||
| 337 | _ssh_cache = {} | 337 | _ssh_cache = {} |
| 338 | _ssh_master = True | 338 | _ssh_master = True |
| 339 | 339 | ||
| 340 | def _open_ssh(host, port=None): | 340 | def _open_ssh(host, port): |
| 341 | global _ssh_master | 341 | global _ssh_master |
| 342 | 342 | ||
| 343 | if port is None: | ||
| 344 | port = 22 | ||
| 345 | |||
| 346 | key = '%s:%s' % (host, port) | 343 | key = '%s:%s' % (host, port) |
| 347 | if key in _ssh_cache: | 344 | if key in _ssh_cache: |
| 348 | return True | 345 | return True |
| @@ -397,6 +394,8 @@ def _preconnect(url): | |||
| 397 | host = m.group(2) | 394 | host = m.group(2) |
| 398 | if ':' in host: | 395 | if ':' in host: |
| 399 | host, port = host.split(':') | 396 | host, port = host.split(':') |
| 397 | else: | ||
| 398 | port = 22 | ||
| 400 | if scheme in ('ssh', 'git+ssh', 'ssh+git'): | 399 | if scheme in ('ssh', 'git+ssh', 'ssh+git'): |
| 401 | return _open_ssh(host, port) | 400 | return _open_ssh(host, port) |
| 402 | return False | 401 | return False |
| @@ -404,7 +403,7 @@ def _preconnect(url): | |||
| 404 | m = URI_SCP.match(url) | 403 | m = URI_SCP.match(url) |
| 405 | if m: | 404 | if m: |
| 406 | host = m.group(1) | 405 | host = m.group(1) |
| 407 | return _open_ssh(host) | 406 | return _open_ssh(host, 22) |
| 408 | 407 | ||
| 409 | 408 | ||
| 410 | class Remote(object): | 409 | class Remote(object): |
