summaryrefslogtreecommitdiff
path: root/src/plugins/diffeditor/diffutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/diffeditor/diffutils.cpp')
-rw-r--r--src/plugins/diffeditor/diffutils.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index a9d9b11ae2..69ddbb9ba9 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -1025,10 +1025,16 @@ static bool detectIndexAndBinary(QStringRef patch,
bool hasNewLine;
*remainingPatch = patch;
- if (remainingPatch->isEmpty() && (fileData->fileOperation == FileData::CopyFile
- || fileData->fileOperation == FileData::RenameFile)) {
- // in case of 100% similarity we don't have more lines in the patch
- return true;
+ if (remainingPatch->isEmpty()) {
+ switch (fileData->fileOperation) {
+ case FileData::CopyFile:
+ case FileData::RenameFile:
+ case FileData::ChangeMode:
+ // in case of 100% similarity we don't have more lines in the patch
+ return true;
+ default:
+ break;
+ }
}
QStringRef afterNextLine;
@@ -1151,8 +1157,6 @@ static bool detectFileData(QStringRef patch,
QStringRef afterSecondLine;
const QStringRef secondLine = readLine(afterDiffGit, &afterSecondLine, &hasNewLine);
- if (!hasNewLine)
- return false; // we need to have at least one more line
if (secondLine.startsWith(QStringLiteral("new file mode "))) {
fileData->fileOperation = FileData::NewFile;
@@ -1165,7 +1169,7 @@ static bool detectFileData(QStringRef patch,
// new mode
readLine(afterSecondLine, &afterThirdLine, &hasNewLine);
if (!hasNewLine)
- return false; // we need to have at least one more line
+ fileData->fileOperation = FileData::ChangeMode;
// TODO: validate new mode line
*remainingPatch = afterThirdLine;