forked from qt-creator/qt-creator
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:
committed by
Orgad Shaneh
parent
0a265ce266
commit
760e6a9b13
@@ -2305,7 +2305,7 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
|||||||
{
|
{
|
||||||
const QFileInfo binaryInfo = vcsBinary().toFileInfo();
|
const QFileInfo binaryInfo = vcsBinary().toFileInfo();
|
||||||
QDir foundBinDir(binaryInfo.dir());
|
QDir foundBinDir(binaryInfo.dir());
|
||||||
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == "cmd";
|
const bool foundBinDirIsBinDir = foundBinDir.dirName() == "bin";
|
||||||
QProcessEnvironment env = processEnvironment();
|
QProcessEnvironment env = processEnvironment();
|
||||||
if (tryLauchingGitK(env, workingDirectory, fileName, foundBinDir.path()))
|
if (tryLauchingGitK(env, workingDirectory, fileName, foundBinDir.path()))
|
||||||
return;
|
return;
|
||||||
@@ -2313,13 +2313,16 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN
|
|||||||
QString gitkPath = foundBinDir.path() + "/gitk";
|
QString gitkPath = foundBinDir.path() + "/gitk";
|
||||||
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
||||||
|
|
||||||
if (foundBinDirIsCmdDir) {
|
if (foundBinDirIsBinDir) {
|
||||||
foundBinDir.cdUp();
|
foundBinDir.cdUp();
|
||||||
|
const QString binDirName = foundBinDir.dirName();
|
||||||
|
if (binDirName == "usr" || binDirName.startsWith("mingw"))
|
||||||
|
foundBinDir.cdUp();
|
||||||
if (tryLauchingGitK(env, workingDirectory, fileName,
|
if (tryLauchingGitK(env, workingDirectory, fileName,
|
||||||
foundBinDir.path() + "/bin")) {
|
foundBinDir.path() + "/cmd")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gitkPath = foundBinDir.path() + "/gitk";
|
gitkPath = foundBinDir.path() + "/cmd/gitk";
|
||||||
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user