diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 2a0110f23dc50ef667a1ddda3b40164c2788ba66..b860ce8790de91f590e66ba0fba81aa7e1b3cae2 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -128,11 +128,12 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const if (errorMessage) errorMessage->clear(); const QString binary = QLatin1String(Constants::GIT_BINARY); + QString currentPath = path; // Easy, git is assumed to be elsewhere accessible if (!adoptPath) - return binary; + currentPath = QString::fromLocal8Bit(qgetenv("PATH")); // Search in path? - const QString pathBinary = Utils::SynchronousProcess::locateBinary(path, binary); + const QString pathBinary = Utils::SynchronousProcess::locateBinary(currentPath, binary); if (pathBinary.isEmpty()) { if (ok) *ok = false; @@ -144,5 +145,5 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const return pathBinary; } -} -} +} // namespace Internal +} // namespace Git diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 0c73c454766e6f8b68716102486f5274031ad4ad..81cd280c6fe89925ac947030f3c403a3384a1923 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -47,6 +47,7 @@ struct GitSettings void fromSettings(QSettings *); void toSettings(QSettings *) const; + /** Return the full path to the git executable */ QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; bool equals(const GitSettings &s) const;