aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitclient.cpp
diff options
context:
space:
mode:
authorRobert Loehning <[email protected]>2010-09-17 12:49:33 +0200
committerRobert Loehning <[email protected]>2010-09-17 13:38:01 +0200
commit96e06a9fbbaa8eb5ee4ac9d53bee09126f9dc269 (patch)
tree0f0d5f4976c119e75ec456f9f425ee8e79400639 /src/plugins/git/gitclient.cpp
parent88bc157b7cdb551a9dbe548d66bc65f2eafe8f3d (diff)
git: Fixed launching of gitk
In cases where binary 'wish' is not in PATH variable this could not be started.
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r--src/plugins/git/gitclient.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 0406b6eaa1a..1b49ccdce95 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1330,6 +1330,21 @@ void GitClient::launchGitK(const QString &workingDirectory)
return;
}
const QString gitBinDirectory = QFileInfo(fullGitBinary).absolutePath();
+ QDir foundBinDir = gitBinDirectory;
+ const bool foundBinDirIsCmdDir = foundBinDir.dirName() == "cmd";
+ if (!tryLauchingGitK(env, workingDirectory, gitBinDirectory, foundBinDirIsCmdDir)) {
+ if (foundBinDirIsCmdDir) {
+ foundBinDir.cdUp();
+ tryLauchingGitK(env, workingDirectory, foundBinDir.path() + "/bin", false);
+ }
+ }
+}
+
+bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
+ const QString &workingDirectory,
+ const QString &gitBinDirectory,
+ bool silent)
+{
#ifdef Q_OS_WIN
// Launch 'wish' shell from git binary directory with the gitk located there
const QString binary = gitBinDirectory + QLatin1String("/wish");
@@ -1339,6 +1354,7 @@ void GitClient::launchGitK(const QString &workingDirectory)
const QString binary = gitBinDirectory + QLatin1String("/gitk");
QStringList arguments;
#endif
+ VCSBase::VCSBaseOutputWindow *outwin = VCSBase::VCSBaseOutputWindow::instance();
if (!m_settings.gitkOptions.isEmpty())
arguments.append(m_settings.gitkOptions.split(QLatin1Char(' ')));
outwin->appendCommand(workingDirectory, binary, arguments);
@@ -1359,8 +1375,14 @@ void GitClient::launchGitK(const QString &workingDirectory)
} else {
success = QProcess::startDetached(binary, arguments, workingDirectory);
}
- if (!success)
- outwin->appendError(tr("Unable to launch %1.").arg(binary));
+ if (!success) {
+ const QString error = tr("Unable to launch %1.").arg(binary);
+ if (silent)
+ outwin->appendSilently(error);
+ else
+ outwin->appendError(error);
+ }
+ return success;
}
bool GitClient::getCommitData(const QString &workingDirectory,