forked from qt-creator/qt-creator
Git: Do not require the path to be set in the config
Fix regression where creator was no longer able to run git if the PATH was not explicitly set in the configuration. Task-number: QTCREATORBUG-2478 Reviewed-by: Robert Loehning
This commit is contained in:
@@ -128,11 +128,12 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
|
|||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
errorMessage->clear();
|
errorMessage->clear();
|
||||||
const QString binary = QLatin1String(Constants::GIT_BINARY);
|
const QString binary = QLatin1String(Constants::GIT_BINARY);
|
||||||
|
QString currentPath = path;
|
||||||
// Easy, git is assumed to be elsewhere accessible
|
// Easy, git is assumed to be elsewhere accessible
|
||||||
if (!adoptPath)
|
if (!adoptPath)
|
||||||
return binary;
|
currentPath = QString::fromLocal8Bit(qgetenv("PATH"));
|
||||||
// Search in path?
|
// Search in path?
|
||||||
const QString pathBinary = Utils::SynchronousProcess::locateBinary(path, binary);
|
const QString pathBinary = Utils::SynchronousProcess::locateBinary(currentPath, binary);
|
||||||
if (pathBinary.isEmpty()) {
|
if (pathBinary.isEmpty()) {
|
||||||
if (ok)
|
if (ok)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
@@ -144,5 +145,5 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
|
|||||||
return pathBinary;
|
return pathBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Internal
|
||||||
}
|
} // namespace Git
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ struct GitSettings
|
|||||||
void fromSettings(QSettings *);
|
void fromSettings(QSettings *);
|
||||||
void toSettings(QSettings *) const;
|
void toSettings(QSettings *) const;
|
||||||
|
|
||||||
|
/** Return the full path to the git executable */
|
||||||
QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const;
|
QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const;
|
||||||
|
|
||||||
bool equals(const GitSettings &s) const;
|
bool equals(const GitSettings &s) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user