From 7b2ef0a3b3e1c390dfb722a94c3bccc17a1abaa6 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Mon, 5 Nov 2012 20:52:29 +0200
Subject: [PATCH] Git: Fix detection for 2-digit versions

1.7.10 is currently detected as 1.7.1

Change-Id: Iaba8ba3e1f6ba880ae088811ccfd133fd7f70e14
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
---
 src/plugins/git/gitclient.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index bb27590aaf6..f70b3438c2a 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -2383,12 +2383,12 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
     }
     // cut 'git version 1.6.5.1.sha'
     const QString output = commandOutputFromLocal8Bit(outputText);
-    QRegExp versionPattern(QLatin1String("^[^\\d]+([\\d])\\.([\\d])\\.([\\d]).*$"));
+    QRegExp versionPattern(QLatin1String("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+).*$"));
     QTC_ASSERT(versionPattern.isValid(), return 0);
     QTC_ASSERT(versionPattern.exactMatch(output), return 0);
-    const unsigned major = versionPattern.cap(1).toUInt();
-    const unsigned minor = versionPattern.cap(2).toUInt();
-    const unsigned patch = versionPattern.cap(3).toUInt();
+    const unsigned major = versionPattern.cap(1).toUInt(0, 16);
+    const unsigned minor = versionPattern.cap(2).toUInt(0, 16);
+    const unsigned patch = versionPattern.cap(3).toUInt(0, 16);
     return version(major, minor, patch);
 }
 
-- 
GitLab