Removed handling of pipe symbol (if available in git output).
This commit is contained in:
parent
0fb38013f7
commit
72cb738af5
@ -135,23 +135,41 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
if (c.execute(m_customerRepository)) { // execute command in local customerRepo
|
||||
QString s = c.getCommandResult().trimmed();
|
||||
QStringList lines = Update::split(s, '\n');
|
||||
|
||||
qInfo() << QString(80, '*');
|
||||
qInfo() << "GIT DIFF RESULT" << lines;
|
||||
qInfo() << QString(80, '*');
|
||||
|
||||
QStringList fileNames;
|
||||
// each line has the format "etc/psa_config/DC2C_print01.json | 1 +
|
||||
// or the format "etc/psa_config/DC2C_print01.json (new) | 1 +
|
||||
// the filenames are relativ to the repository
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
// TODO: koennte auch (delete) kommen ?
|
||||
int newIndex = lines.at(i).indexOf("(new)"); // for new files
|
||||
// int goneIndex = lines.at(i).indexOf("(gone)"); // for removed files
|
||||
QString const &line = lines.at(i);
|
||||
int newIndex = line.indexOf("(new"); // for new files
|
||||
int goneIndex = line.indexOf("(gone"); // for removed files
|
||||
int modeIndex = line.indexOf("(mode");
|
||||
// int pipeIndex = line.indexOf('|');
|
||||
if (newIndex != -1) {
|
||||
QString fileName = lines.at(i).mid(0, newIndex).trimmed();
|
||||
fileNames << fileName;
|
||||
} else {
|
||||
int pipeIndex = lines.at(i).indexOf('|');
|
||||
if (pipeIndex != -1) {
|
||||
QString fileName = lines.at(i).mid(0, pipeIndex).trimmed();
|
||||
fileNames << fileName;
|
||||
}
|
||||
QString file = line.left(newIndex).trimmed();
|
||||
qInfo() << "FILE (NEW)" << file;
|
||||
fileNames << file;
|
||||
} else
|
||||
if (modeIndex != -1) {
|
||||
QString const file = line.left(modeIndex).trimmed();
|
||||
qInfo() << "FILE (MODE)" << file;
|
||||
fileNames << file;
|
||||
} else
|
||||
//if (pipeIndex != -1) {
|
||||
// QString const file = line.left(pipeIndex).trimmed();
|
||||
// qInfo() << "FILE (PIPE)" << file;
|
||||
// fileNames << file;
|
||||
//} else
|
||||
if (goneIndex != -1) {
|
||||
QString const file = line.left(goneIndex).trimmed();
|
||||
qCritical() << QString(80, '*');
|
||||
qCritical() << "FILE (GONE)" << file;
|
||||
qCritical() << QString(80, '*');
|
||||
}
|
||||
}
|
||||
if (!fileNames.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user