Explorar el Código

Only pass key_filename and password into SSHVendor.run_command if they are set (for backwards compatibility)

Jelmer Vernooij hace 7 años
padre
commit
d8bea03825
Se han modificado 2 ficheros con 11 adiciones y 1 borrados
  1. 5 0
      NEWS
  2. 6 1
      dulwich/client.py

+ 5 - 0
NEWS

@@ -21,6 +21,11 @@
   * New 'client.PLinkSSHVendor' for creating connections using PuTTY's plink.exe.
     (Adam Bradley, Filipp Frizzy)
 
+  * Only pass in `key_filename` and `password` to SSHVendor
+    implementations if those parameters are set.
+    (This helps with older SSHVendor implementations)
+    (Jelmer Vernooij)
+
  API CHANGES
 
   * Index.iterblobs has been renamed to Index.iterobjects.

+ 6 - 1
dulwich/client.py

@@ -1221,9 +1221,14 @@ class SSHGitClient(TraditionalGitClient):
             path = path[1:]
         argv = (self._get_cmd_path(cmd).decode(self._remote_path_encoding) +
                 " '" + path + "'")
+        kwargs = {}
+        if self.password is not None:
+            kwargs['password'] = self.password
+        if self.key_filename is not None:
+            kwargs['key_filename'] = self.key_filename
         con = self.ssh_vendor.run_command(
             self.host, argv, port=self.port, username=self.username,
-            password=self.password, key_filename=self.key_filename)
+            **kwargs)
         return (Protocol(con.read, con.write, con.close,
                          report_activity=self._report_activity),
                 con.can_read)