Take the pipe symbol into account in output of git getch command.
This commit is contained in:
parent
34334676fc
commit
0e97ce7dc2
@ -129,6 +129,7 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
QString s = c.getCommandResult().trimmed();
|
||||
Utils::printInfoMsg("GIT DIFF RESULT " + s);
|
||||
|
||||
QStringList lines = Update::split(s, '\n');
|
||||
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 +
|
||||
@ -138,7 +139,7 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
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('|');
|
||||
int pipeIndex = line.indexOf('|');
|
||||
if (newIndex != -1) {
|
||||
QString file = line.left(newIndex).trimmed();
|
||||
qInfo() << "FILE (NEW)" << file;
|
||||
@ -149,16 +150,14 @@ std::optional<QStringList> GitClient::gitDiff(QString const &commits) {
|
||||
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, '*');
|
||||
} else
|
||||
if (pipeIndex != -1) {
|
||||
QString const file = line.left(pipeIndex).trimmed();
|
||||
qInfo() << "FILE (PIPE)" << file;
|
||||
fileNames << file;
|
||||
}
|
||||
}
|
||||
if (!fileNames.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user