forked from qt-creator/qt-creator
DiffEditor: Fix parsing of dirty submodule diff
It has no index. Change-Id: Ifbc06045f3b39245288d15bdf44f8053fe443bc8 Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
2259aa12f5
commit
9dbc785a80
@@ -871,6 +871,32 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
|||||||
QTest::newRow("Multiple renames") << patch
|
QTest::newRow("Multiple renames") << patch
|
||||||
<< fileDataList6;
|
<< fileDataList6;
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
// Dirty submodule
|
||||||
|
patch = _("diff --git a/src/shared/qbs b/src/shared/qbs\n"
|
||||||
|
"--- a/src/shared/qbs\n"
|
||||||
|
"+++ b/src/shared/qbs\n"
|
||||||
|
"@@ -1 +1 @@\n"
|
||||||
|
"-Subproject commit eda76354077a427d692fee05479910de31040d3f\n"
|
||||||
|
"+Subproject commit eda76354077a427d692fee05479910de31040d3f-dirty\n"
|
||||||
|
);
|
||||||
|
fileData1 = FileData();
|
||||||
|
fileData1.leftFileInfo = DiffFileInfo(_("src/shared/qbs"));
|
||||||
|
fileData1.rightFileInfo = DiffFileInfo(_("src/shared/qbs"));
|
||||||
|
chunkData1.leftStartingLineNumber = 0;
|
||||||
|
chunkData1.rightStartingLineNumber = 0;
|
||||||
|
rows1.clear();
|
||||||
|
rows1 << RowData(_("Subproject commit eda76354077a427d692fee05479910de31040d3f"),
|
||||||
|
_("Subproject commit eda76354077a427d692fee05479910de31040d3f-dirty"));
|
||||||
|
chunkData1.rows = rows1;
|
||||||
|
fileData1.chunks.clear();
|
||||||
|
fileData1.chunks << chunkData1;
|
||||||
|
|
||||||
|
QList<FileData> fileDataList7;
|
||||||
|
fileDataList7 << fileData1;
|
||||||
|
QTest::newRow("Dirty submodule") << patch
|
||||||
|
<< fileDataList7;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
|
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
|
||||||
|
|||||||
@@ -918,6 +918,7 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
|
|||||||
fileData.rightFileInfo.typeInfo = indexRegExp.cap(2);
|
fileData.rightFileInfo.typeInfo = indexRegExp.cap(2);
|
||||||
|
|
||||||
patch.remove(0, indexRegExp.matchedLength());
|
patch.remove(0, indexRegExp.matchedLength());
|
||||||
|
}
|
||||||
|
|
||||||
const QRegExp leftFileRegExp(QLatin1String("^-{3} ") // "--- "
|
const QRegExp leftFileRegExp(QLatin1String("^-{3} ") // "--- "
|
||||||
+ leftFileName // "a/fileName" or "/dev/null"
|
+ leftFileName // "a/fileName" or "/dev/null"
|
||||||
@@ -951,7 +952,6 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
|
|||||||
readOk = true;
|
readOk = true;
|
||||||
fileData.binaryFiles = true;
|
fileData.binaryFiles = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
*ok = readOk;
|
*ok = readOk;
|
||||||
|
|||||||
Reference in New Issue
Block a user