From 151ae22bb90e5b1a4acf857773e6a8a719c09712 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 23 Feb 2017 14:48:56 +0200 Subject: [PATCH] Git: Fix "additional tools" path with "Git for Windows" They're in usr/bin now. Change-Id: I5efe5f7fcaf1f74393624b9bb8dd0ab3f0075d3e Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 0ef6756103f..55976d218c0 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2249,9 +2249,18 @@ FileName GitClient::gitBinDirectory() // Git for Windows has git and gitk redirect executables in {setup dir}/cmd // and the real binaries are in {setup dir}/bin. If cmd is configured in PATH // or in Git settings, return bin instead. - if (HostOsInfo::isWindowsHost() - && path.endsWith("/cmd", HostOsInfo::fileNameCaseSensitivity())) { - path.replace(path.size() - 3, 3, "bin"); + if (HostOsInfo::isWindowsHost()) { + if (path.endsWith("/cmd", Qt::CaseInsensitive)) + path.replace(path.size() - 3, 3, "bin"); + if (path.endsWith("/bin", Qt::CaseInsensitive) + && !path.endsWith("/usr/bin", Qt::CaseInsensitive)) { + // Legacy msysGit used Git/bin for additional tools. + // Git for Windows uses Git/usr/bin. Prefer that if it exists. + QString usrBinPath = path; + usrBinPath.replace(usrBinPath.size() - 3, 3, "usr/bin"); + if (QFile::exists(usrBinPath)) + path = usrBinPath; + } } return FileName::fromString(path); }