rakelib/hglib.rb
changeset 85 6d918f722075
parent 83 8405c22a8ffd
child 86 f2a7a4378c22
--- a/rakelib/hglib.rb	Thu Nov 24 20:22:25 2016 +0000
+++ b/rakelib/hglib.rb	Thu Nov 24 20:47:41 2016 +0000
@@ -196,13 +196,21 @@
                 ssh = "\"c:\\msys64\\usr\\bin\\ssh.exe\""
               end
             end
-            # A downside of messing with ssh configuration is that OpenSSH client does not know how
-            # to connect to pageant. So issue a warning...
+            # Sigh, we should not tamper with SSH configuration wildly. User may have
+            # her ssh and mercurial properly configured to use `plink.exe` and `pageant`.
+            # If we just start using `ssh.exe` clone/pull might not work beause
+            # `ssh.exe` cannot talk to `pageant`. So, if we don't find OpenSSH's 
+            # style of agent, don't use `ssh.exe` event if available.
             if ssh then
-              $LOGGER.info("Passing --ssh \"#{ssh}\" option to 'hg' command to reduce CPU load on LAN tranfers")
-              if not ENV['SSH_AUTH_SOCK'] then
-                  $LOGGER.warn("Transfet may fail since MSYS2 `ssh.exe` dont know how to talk to pageant. ")
-                  $LOGGER.warn("Consider using ssh-agent or ssh-pageant (if you want to use PuTTY's pageant)")
+              if ENV['SSH_AUTH_SOCK'] then
+                # Good, OpenSSH agent running but still, be nice and  tell the 
+                # user SSH configuration has been tampered wirh. 
+                $LOGGER.info("Passing --ssh \"#{ssh}\" option to 'hg' command for faster transfers")
+              else 
+                # No agent, no fun. Be nice and give user a hit
+                $LOGGER.warn("Not using -ssh \"#{ssh}\" option because SSH agent is not running")
+                $LOGGER.warn("For faster clone/pull consider using ssh-agent or ssh-pageant (if you want to use PuTTY's pageant)")
+                ssh = nil
               end
             end
             # Turn off SSH compression - data transferred by Mercurial are either