forked from qt-creator/qt-creator
Gerrit: Improve default SSH lookup
* Append exe suffix * Detect also if not found (for example, when upgrading from msysGit to Git for Windows). Change-Id: I9c47f0f4e54e957e21e224f100c2959dc1884ec2 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
f3f5a16f27
commit
351f6b8f11
@@ -58,13 +58,14 @@ static inline QString detectSsh()
|
||||
const QByteArray gitSsh = qgetenv("GIT_SSH");
|
||||
if (!gitSsh.isEmpty())
|
||||
return QString::fromLocal8Bit(gitSsh);
|
||||
QString ssh = QStandardPaths::findExecutable(defaultSshC);
|
||||
const QString defaultSsh = Utils::HostOsInfo::withExecutableSuffix(defaultSshC);
|
||||
QString ssh = QStandardPaths::findExecutable(defaultSsh);
|
||||
if (!ssh.isEmpty())
|
||||
return ssh;
|
||||
if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
|
||||
Utils::FileName path = GerritPlugin::gitBinDirectory();
|
||||
if (!path.isEmpty())
|
||||
ssh = path.appendPath(defaultSshC).toString();
|
||||
ssh = path.appendPath(defaultSsh).toString();
|
||||
}
|
||||
return ssh;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ void GerritParameters::fromSettings(const QSettings *s)
|
||||
savedQueries = s->value(rootKey + savedQueriesKeyC, QString()).toString()
|
||||
.split(',');
|
||||
https = s->value(rootKey + httpsKeyC, QVariant(true)).toBool();
|
||||
if (ssh.isEmpty())
|
||||
if (ssh.isEmpty() || !QFile::exists(ssh))
|
||||
ssh = detectSsh();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user