Do not invoke ssh with -p argument when no port has been specified.

This change allows local SSH configuration to choose the port number
to use when not explicitly set in the manifest.

(cherry picked from commit 4c0f67046543c7c6ab24175e143001f14b76ea01)

Change-Id: Ibea99cfe46b6a2cc27f754cc3944a2fe10f6fda4
diff --git a/git_config.py b/git_config.py
index 75936d4..dc209ba 100644
--- a/git_config.py
+++ b/git_config.py
@@ -359,10 +359,14 @@
 _ssh_cache = {}
 _ssh_master = True
 
-def _open_ssh(host, port):
+def _open_ssh(host, port=None):
   global _ssh_master
 
-  key = '%s:%s' % (host, port)
+  if port is not None:
+    key = '%s:%s' % (host, port)
+  else:
+    key = host
+
   if key in _ssh_cache:
     return True
 
@@ -375,10 +379,13 @@
 
   command = ['ssh',
              '-o','ControlPath %s' % ssh_sock(),
-             '-p',str(port),
              '-M',
              '-N',
              host]
+
+  if port is not None:
+    command[3:3] = ['-p',str(port)]
+
   try:
     Trace(': %s', ' '.join(command))
     p = subprocess.Popen(command)
@@ -422,7 +429,7 @@
     if ':' in host:
       host, port = host.split(':')
     else:
-      port = 22
+      port = None
     if scheme in ('ssh', 'git+ssh', 'ssh+git'):
       return _open_ssh(host, port)
     return False
@@ -430,7 +437,7 @@
   m = URI_SCP.match(url)
   if m:
     host = m.group(1)
-    return _open_ssh(host, 22)
+    return _open_ssh(host)
 
   return False