summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/baseline/shared/baselineprotocol.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/baseline/shared/baselineprotocol.cpp b/tests/baseline/shared/baselineprotocol.cpp
index ab6ced204a..d3177b3d8b 100644
--- a/tests/baseline/shared/baselineprotocol.cpp
+++ b/tests/baseline/shared/baselineprotocol.cpp
@@ -70,24 +70,26 @@ PlatformInfo PlatformInfo::localHostInfo()
#endif
pi.insert(PI_OSVersion, QSysInfo::kernelVersion());
+ QString gc = qEnvironmentVariable("BASELINE_GIT_COMMIT");
#if QT_CONFIG(process)
- QProcess git;
- QString cmd;
- QStringList args;
-#if defined(Q_OS_WIN)
- cmd = QLS("cmd.exe");
- args << QLS("/c") << QLS("git");
-#else
- cmd = QLS("git");
-#endif
- args << QLS("log") << QLS("--max-count=1") << QLS("--pretty=%H [%an] [%ad] %s");
- git.start(cmd, args);
- git.waitForFinished(3000);
- if (!git.exitCode())
- pi.insert(PI_GitCommit, QString::fromLocal8Bit(git.readAllStandardOutput().constData()).simplified());
- else
- pi.insert(PI_GitCommit, QLS("Unknown"));
+ if (gc.isEmpty()) {
+ QProcess git;
+ QString cmd;
+ QStringList args;
+ #if defined(Q_OS_WIN)
+ cmd = QLS("cmd.exe");
+ args << QLS("/c") << QLS("git");
+ #else
+ cmd = QLS("git");
+ #endif
+ args << QLS("log") << QLS("--max-count=1") << QLS("--pretty=%H [%an] [%ad] %s");
+ git.start(cmd, args);
+ git.waitForFinished(3000);
+ if (!git.exitCode())
+ gc = QString::fromLocal8Bit(git.readAllStandardOutput().constData()).simplified();
+ }
#endif // QT_CONFIG(process)
+ pi.insert(PI_GitCommit, gc.isEmpty() ? QLS("Unknown") : gc);
if (qEnvironmentVariableIsSet("JENKINS_HOME"))
pi.setAdHocRun(false);