Use defined codes and strings.

This commit is contained in:
2025-02-21 12:37:00 +01:00
parent 5d3849dcf3
commit 96e3b606ef
3 changed files with 26 additions and 2 deletions

View File

@@ -15,6 +15,7 @@
#include <QRegularExpression>
#include <QFile>
#include <QTextStream>
#include <QRegularExpression>
#include <optional>
@@ -90,6 +91,19 @@ int main(int argc, char **argv) {
if (!gitCmd.pull()) {
return -4;
}
QString const result = gitCmd.commandResult().trimmed();
if (result.contains("Already", Qt::CaseInsensitive)
&& result.contains("up", Qt::CaseInsensitive)
&& result.contains("to", Qt::CaseInsensitive)
&& result.contains("date", Qt::CaseInsensitive)) {
qCritical() << internal::GIT_CUSTOMER_REPO_NO_UPDATE_NECESSARY;
return internal::GIT_NOT_NECESSARY_CODE;
} else
if (result.contains(QRegularExpression("[Uu]pdating\\s+[a-z0-9]{6,}\\.\\.[a-z0-9]{6,}"))) {
// Updating 49a97f5..13a0321
qCritical() << internal::GIT_CUSTOMER_REPO_UPDATED;
return internal::GIT_UPDATED_CODE;
}
} else {
if (!gitCmd.clone()) {
return -3;