summaryrefslogtreecommitdiff
path: root/src/plugins/diffeditor/diffutils.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-08-24 20:30:18 +0300
committerOrgad Shaneh <orgads@gmail.com>2015-08-25 06:48:49 +0000
commitd618c05e3a71f5978a9619415e7241d2e18dacbe (patch)
tree05600d136a2e20858e04252d51af5c12569d80bc /src/plugins/diffeditor/diffutils.cpp
parent9bd066cb94f0b56b96c90a2bad375572190031d3 (diff)
downloadqt-creator-d618c05e3a71f5978a9619415e7241d2e18dacbe.tar.gz
DiffEditor: Support mode change in Git diff
Task-number: QTCREATORBUG-14963 Change-Id: I5d26ae810add657a94fb40a5d4437e2d17a1625a Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/plugins/diffeditor/diffutils.cpp')
-rw-r--r--src/plugins/diffeditor/diffutils.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index 9bc5d3a75e..9b136df250 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -892,6 +892,8 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
// will be followed by: index shasha..0000000, file "b" replaced by "/dev/null", @@ -m,n +0,0 @@
const QRegExp deletedFileMode(QLatin1String("^deleted file mode \\d+\\n")); // deleted file mode octal
+ const QRegExp modeChangeRegExp(QLatin1String("^old mode \\d+\\nnew mode \\d+\\n"));
+
const QRegExp indexRegExp(QLatin1String("^index (\\w+)\\.{2}(\\w+)(?: \\d+)?(\\n|$)")); // index cap1..cap2(optionally: octal)
QString leftFileName = QLatin1String("a/") + fileName;
@@ -905,6 +907,8 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
fileData.fileOperation = FileData::DeleteFile;
rightFileName = devNull;
patch.remove(0, deletedFileMode.matchedLength());
+ } else if (modeChangeRegExp.indexIn(patch) == 0) {
+ patch.remove(0, modeChangeRegExp.matchedLength());
}
if (indexRegExp.indexIn(patch) == 0) {