[gitg] Fix fallback for failed ssh public key auth



commit 1f0f2a415c740dd6da474697d7e5ecca6c70b1d8
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Thu Dec 25 12:12:10 2014 +0100

    Fix fallback for failed ssh public key auth

 libgitg/gitg-credentials-manager.vala |    2 +-
 libgitg/gitg-remote.vala              |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libgitg/gitg-credentials-manager.vala b/libgitg/gitg-credentials-manager.vala
index db2d8c1..4e98d3e 100644
--- a/libgitg/gitg-credentials-manager.vala
+++ b/libgitg/gitg-credentials-manager.vala
@@ -249,7 +249,7 @@ public class CredentialsManager
                                      string?       username,
                                      Ggit.Credtype allowed_types) throws Error
        {
-               if (d_remote.authentication_error != null && (allowed_types & Ggit.Credtype.SSH_KEY) != 0)
+               if (d_remote.authentication_error == null && (allowed_types & Ggit.Credtype.SSH_KEY) != 0)
                {
                        return new Ggit.CredSshKeyFromAgent(username);
                }
diff --git a/libgitg/gitg-remote.vala b/libgitg/gitg-remote.vala
index b04f1a9..41ed34f 100644
--- a/libgitg/gitg-remote.vala
+++ b/libgitg/gitg-remote.vala
@@ -113,8 +113,10 @@ public class Remote : Ggit.Remote
                        catch (Error e)
                        {
                                // NOTE: need to check the message for now in case of failed
-                               // http auth.
-                               if (e.message == "Unexpected HTTP status code: 401")
+                               // http or ssh auth. This is fragile and will likely break
+                               // in future libgit2 releases. Please fix!
+                               if (e.message == "Unexpected HTTP status code: 401" ||
+                                   e.message == "error authenticating: Username/PublicKey combination 
invalid")
                                {
                                        d_authentication_error = e;
                                        continue;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]