diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp
index f8f2ce4183b561c4ebb95b3468491cab9fcacea8..fc88e8fffd677c137661d05f1e9d87de503aef16 100644
--- a/src/plugins/diffeditor/diffeditorplugin.cpp
+++ b/src/plugins/diffeditor/diffeditorplugin.cpp
@@ -871,6 +871,32 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
     QTest::newRow("Multiple renames") << patch
                                       << 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()
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index b5ed3a62099dea68d4a8f7c90a6828c4e0809145..589c4ddb84e0b377bef4c1f7d9999b9dcb4d9ed8 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -918,39 +918,39 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
         fileData.rightFileInfo.typeInfo = indexRegExp.cap(2);
 
         patch.remove(0, indexRegExp.matchedLength());
+    }
 
-        const QRegExp leftFileRegExp(QLatin1String("^-{3} ")                 // "--- "
-                                     + leftFileName                          // "a/fileName" or "/dev/null"
-                                     + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...)
-        const QRegExp rightFileRegExp(QLatin1String("^\\+{3} ")               // "+++ "
-                                      + rightFileName                         // "b/fileName" or "/dev/null"
-                                      + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...)
-        const QRegExp binaryRegExp(QLatin1String("^Binary files ")
-                                   + leftFileName
-                                   + QLatin1String(" and ")
-                                   + rightFileName
-                                   + QLatin1String(" differ$"));
-
-        // empty or followed either by leftFileRegExp or by binaryRegExp
-        if (patch.isEmpty() && (fileData.fileOperation == FileData::NewFile
-                             || fileData.fileOperation == FileData::DeleteFile)) {
-            readOk = true;
-        } else if (leftFileRegExp.indexIn(patch) == 0) {
-            patch.remove(0, leftFileRegExp.matchedLength());
+    const QRegExp leftFileRegExp(QLatin1String("^-{3} ")                 // "--- "
+                                 + leftFileName                          // "a/fileName" or "/dev/null"
+                                 + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...)
+    const QRegExp rightFileRegExp(QLatin1String("^\\+{3} ")               // "+++ "
+                                  + rightFileName                         // "b/fileName" or "/dev/null"
+                                  + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...)
+    const QRegExp binaryRegExp(QLatin1String("^Binary files ")
+                               + leftFileName
+                               + QLatin1String(" and ")
+                               + rightFileName
+                               + QLatin1String(" differ$"));
+
+    // empty or followed either by leftFileRegExp or by binaryRegExp
+    if (patch.isEmpty() && (fileData.fileOperation == FileData::NewFile
+                         || fileData.fileOperation == FileData::DeleteFile)) {
+        readOk = true;
+    } else if (leftFileRegExp.indexIn(patch) == 0) {
+        patch.remove(0, leftFileRegExp.matchedLength());
 
-            // followed by rightFileRegExp
-            if (rightFileRegExp.indexIn(patch) == 0) {
-                patch.remove(0, rightFileRegExp.matchedLength());
+        // followed by rightFileRegExp
+        if (rightFileRegExp.indexIn(patch) == 0) {
+            patch.remove(0, rightFileRegExp.matchedLength());
 
-                fileData.chunks = readChunks(patch,
-                                             ignoreWhitespace,
-                                             &fileData.lastChunkAtTheEndOfFile,
-                                             &readOk);
-            }
-        } else if (binaryRegExp.indexIn(patch) == 0) {
-            readOk = true;
-            fileData.binaryFiles = true;
+            fileData.chunks = readChunks(patch,
+                                         ignoreWhitespace,
+                                         &fileData.lastChunkAtTheEndOfFile,
+                                         &readOk);
         }
+    } else if (binaryRegExp.indexIn(patch) == 0) {
+        readOk = true;
+        fileData.binaryFiles = true;
     }
 
     if (ok)