From 094b8248c0f63c5aa44af1f8761daeb5c7b17b69 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@digia.com>
Date: Thu, 22 Nov 2012 15:28:05 +0100
Subject: [PATCH] qt5_tool: Fix locating utilities for msysgit 1.8.

git.exe is now in the cmd folder.

Change-Id: I84892a88a79d2dbc97bcf2419cfff095bfc33638
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
 bin/qt5_tool | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/qt5_tool b/bin/qt5_tool
index a3bf0a3..7d6116f 100755
--- a/bin/qt5_tool
+++ b/bin/qt5_tool
@@ -142,14 +142,16 @@ sub which
 }
 
 # -- Locate an utility (grep, scp, etc) in MSYS git. This is specifically
-#    for the setup case in which only git.cmd and not the utilities are in
-#    the path. We then look at the git.cmd and return ..\bin\<utility>.exe.
+#    for the setup case in which only git from the cmd folder and not the utilities
+#    are in the path. We then look at the git and return ..\bin\<utility>.exe.
 sub msysGitUtility
 {
-#   -- Look for 'git.cmd' and cd ..\bin
+#   -- Look for 'cmd/git(.exe,.cmd)' and cd ..\bin. Note that as of msygit 1.8, git.exe
+#      is in cmd.
     my ($git, $utility) = @_;
-    if ($git =~ /.cmd$/i) {
-        my $msysGitBinFolder = File::Spec->catfile(dirname(dirname($git)), 'bin');
+    my $gitBinDir = dirname($git);
+    if ($gitBinDir =~ /cmd$/i) {
+        my $msysGitBinFolder = File::Spec->catfile(dirname($gitBinDir), 'bin');
         return File::Spec->catfile($msysGitBinFolder, $utility . '.exe');
     }
     return $utility;
-- 
GitLab