Git: Fix "additional tools" path with "Git for Windows"

They're in usr/bin now.

Change-Id: I5efe5f7fcaf1f74393624b9bb8dd0ab3f0075d3e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2017-02-23 14:48:56 +02:00
committed by Orgad Shaneh
parent 351f6b8f11
commit 151ae22bb9

View File

@@ -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);
}