Use defined codes and strings.
This commit is contained in:
14
Git/main.cpp
14
Git/main.cpp
@@ -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;
|
||||
|
Reference in New Issue
Block a user