Git: Fix launching of gitk when not in PATH

Tries the following:
* <git binary path>/gitk
* If git path ends with bin [or usr/bin, or mingw*/bin], try ../[../]cmd
* Search gitk in the PATH

Task-number: QTCREATORBUG-1577
Change-Id: I7f5e3d490bfeb527e2a5c1720126f1345e07eee0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2018-09-02 22:49:26 +03:00
committed by Orgad Shaneh
parent 0a265ce266
commit 760e6a9b13

View File

@@ -2305,7 +2305,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
{
const QFileInfo binaryInfo = vcsBinary().toFileInfo();
QDir foundBinDir(binaryInfo.dir());
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == "cmd";
const bool foundBinDirIsBinDir = foundBinDir.dirName() == "bin";
QProcessEnvironment env = processEnvironment();
if (tryLauchingGitK(env, workingDirectory, fileName, foundBinDir.path()))
return;
@@ -2313,13 +2313,16 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
QString gitkPath = foundBinDir.path() + "/gitk";
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
if (foundBinDirIsCmdDir) {
if (foundBinDirIsBinDir) {
foundBinDir.cdUp();
const QString binDirName = foundBinDir.dirName();
if (binDirName == "usr" || binDirName.startsWith("mingw"))
foundBinDir.cdUp();
if (tryLauchingGitK(env, workingDirectory, fileName,
foundBinDir.path() + "/bin")) {
foundBinDir.path() + "/cmd")) {
return;
}
gitkPath = foundBinDir.path() + "/gitk";
gitkPath = foundBinDir.path() + "/cmd/gitk";
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
}