Fixes: add timeout value to git plugin

RevBy:    tba
Details:  - as on windows some git commands take much longer it happens fairly often, that git timeouts.
          - added a timeout value to the option to let the user choose maximum timeout value (minimum is 10 seconds, maximum 5 minutes)
This commit is contained in:
lowinu
2009-02-13 12:52:01 +01:00
parent ae7864f9c0
commit b6c15d1ba9
7 changed files with 48 additions and 22 deletions

View File

@@ -55,8 +55,9 @@ static inline QStringList environmentToList(const ProjectExplorer::Environment &
return ProjectExplorer::Environment::systemEnvironment().toStringList();
}
GitCommand::Job::Job(const QStringList &a) :
arguments(a)
GitCommand::Job::Job(const QStringList &a, int t) :
arguments(a),
timeout(t)
{
}
@@ -67,9 +68,9 @@ GitCommand::GitCommand(const QString &workingDirectory,
{
}
void GitCommand::addJob(const QStringList &arguments)
void GitCommand::addJob(const QStringList &arguments, int timeout)
{
m_jobs.push_back(Job(arguments));
m_jobs.push_back(Job(arguments, timeout));
}
void GitCommand::execute()
@@ -109,7 +110,7 @@ void GitCommand::run()
qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
process.start(QLatin1String(Constants::GIT_BINARY), m_jobs.at(j).arguments);
if (!process.waitForFinished()) {
if (!process.waitForFinished(m_jobs.at(j).timeout * 1000)) {
ok = false;
error += QLatin1String("Error: Git timed out");
break;