diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp
index 5dac850ce8ec11eca94a230ad5370b1b4589d5c4..0d4412c1acf05f1a5f934495ed8fe036b46c0ad5 100644
--- a/src/plugins/diffeditor/diffeditor.cpp
+++ b/src/plugins/diffeditor/diffeditor.cpp
@@ -322,12 +322,12 @@ QWidget *DiffEditor::toolBar()
     whitespaceButton->setText(tr("Ignore Whitespace"));
     whitespaceButton->setCheckable(true);
     whitespaceButton->setChecked(m_controller->isIgnoreWhitespace());
-    m_toolBar->addWidget(whitespaceButton);
+    m_whitespaceButtonAction = m_toolBar->addWidget(whitespaceButton);
 
     QLabel *contextLabel = new QLabel(m_toolBar);
     contextLabel->setText(tr("Context Lines:"));
     contextLabel->setContentsMargins(6, 0, 6, 0);
-    m_toolBar->addWidget(contextLabel);
+    m_contextLabelAction = m_toolBar->addWidget(contextLabel);
 
     QSpinBox *contextSpinBox = new QSpinBox(m_toolBar);
     contextSpinBox->setRange(1, 100);
@@ -335,7 +335,7 @@ QWidget *DiffEditor::toolBar()
     contextSpinBox->setFrame(false);
     contextSpinBox->setSizePolicy(QSizePolicy::Minimum,
                                   QSizePolicy::Expanding); // Mac Qt5
-    m_toolBar->addWidget(contextSpinBox);
+    m_contextSpinBoxAction = m_toolBar->addWidget(contextSpinBox);
 
     QToolButton *toggleDescription = new QToolButton(m_toolBar);
     toggleDescription->setIcon(
@@ -497,6 +497,9 @@ void DiffEditor::slotDescriptionVisibilityChanged()
 
 void DiffEditor::slotReloaderChanged(DiffEditorReloader *reloader)
 {
+    m_whitespaceButtonAction->setVisible(reloader);
+    m_contextLabelAction->setVisible(reloader);
+    m_contextSpinBoxAction->setVisible(reloader);
     m_reloadAction->setVisible(reloader);
 }
 
diff --git a/src/plugins/diffeditor/diffeditor.h b/src/plugins/diffeditor/diffeditor.h
index c843fd3326114626ff255bbbadb0285d2ece15a2..74ebb4bf1f85cf76bf0d459633950b1136d4ce51 100644
--- a/src/plugins/diffeditor/diffeditor.h
+++ b/src/plugins/diffeditor/diffeditor.h
@@ -104,6 +104,9 @@ private:
     DiffEditorGuiController *m_guiController;
     QToolBar *m_toolBar;
     QComboBox *m_entriesComboBox;
+    QAction *m_whitespaceButtonAction;
+    QAction *m_contextLabelAction;
+    QAction *m_contextSpinBoxAction;
     QAction *m_toggleDescriptionAction;
     QAction *m_reloadAction;
     QToolButton *m_diffEditorSwitcher;
diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp
index 1a9e145fec4877744e49fc551b88d99f70495881..5aeb8d27058e31b6380896d15fc28c3f9ec62991 100644
--- a/src/plugins/diffeditor/diffeditorcontroller.cpp
+++ b/src/plugins/diffeditor/diffeditorcontroller.cpp
@@ -64,7 +64,7 @@ DiffEditorController::DiffEditorController(QObject *parent)
 
 DiffEditorController::~DiffEditorController()
 {
-
+    delete m_reloader;
 }
 
 QString DiffEditorController::clearMessage() const
@@ -137,20 +137,20 @@ DiffEditorReloader *DiffEditorController::reloader() const
     return m_reloader;
 }
 
+// The ownership of reloader is passed to the controller
 void DiffEditorController::setReloader(DiffEditorReloader *reloader)
 {
     if (m_reloader == reloader)
         return; // nothing changes
 
-    if (m_reloader)
-        m_reloader->setController(0);
+    delete m_reloader;
 
     m_reloader = reloader;
 
     if (m_reloader)
         m_reloader->setController(this);
 
-    reloaderChanged(m_reloader);
+    emit reloaderChanged(m_reloader);
 }
 
 void DiffEditorController::clear()
diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp
index 517717c92d9c5588f7dbbf1841aaeb3824889051..db28ee601dec791a208fbe4f61d79814c0a66510 100644
--- a/src/plugins/diffeditor/diffeditordocument.cpp
+++ b/src/plugins/diffeditor/diffeditordocument.cpp
@@ -31,6 +31,8 @@
 #include "diffeditordocument.h"
 #include "diffeditorconstants.h"
 #include "diffeditorcontroller.h"
+#include "diffeditormanager.h"
+#include "diffeditorreloader.h"
 #include "diffutils.h"
 
 #include <coreplugin/editormanager/editormanager.h>
@@ -83,6 +85,10 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
     if (!ok)
         return false;
 
+    if (m_controller->reloader())
+        m_controller->setReloader(0);
+
+    DiffEditorManager::removeDocument(this);
     const QFileInfo fi(fileName);
     setTemporary(false);
     setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
@@ -105,10 +111,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
         return false;
 
     bool ok = false;
-    QList<FileData> fileDataList
-            = DiffUtils::readPatch(patch,
-                                   m_controller->isIgnoreWhitespace(),
-                                   &ok);
+    QList<FileData> fileDataList = DiffUtils::readPatch(patch, &ok);
     if (!ok) {
         *errorString = tr("Could not parse patch file \"%1\". "
                           "The content is not of unified diff format.")
diff --git a/src/plugins/diffeditor/diffeditormanager.cpp b/src/plugins/diffeditor/diffeditormanager.cpp
index ee883f931544496e0f6551fdd8767f0a25ff3637..a8d306ad0794d0cdfe7a6a1c054d124eb518bdf1 100644
--- a/src/plugins/diffeditor/diffeditormanager.cpp
+++ b/src/plugins/diffeditor/diffeditormanager.cpp
@@ -115,5 +115,14 @@ DiffEditorDocument *DiffEditorManager::findOrCreate(const QString &documentId, c
     return document;
 }
 
+void DiffEditorManager::removeDocument(DiffEditorDocument *document)
+{
+    if (!instance()->documentToId.contains(document))
+        return;
+    const QString documentId = instance()->documentToId.value(document);
+    instance()->documentToId.remove(document);
+    instance()->idToDocument.remove(documentId);
+}
+
 
 } // namespace DiffEditor
diff --git a/src/plugins/diffeditor/diffeditormanager.h b/src/plugins/diffeditor/diffeditormanager.h
index 9bc0d60e598301519b67b04dc86f42f32c291989..9a4be0958186801c2577abc97fa41cce96bbf4f6 100644
--- a/src/plugins/diffeditor/diffeditormanager.h
+++ b/src/plugins/diffeditor/diffeditormanager.h
@@ -53,6 +53,7 @@ public:
 
     static DiffEditorDocument *find(const QString &documentId);
     static DiffEditorDocument *findOrCreate(const QString &documentId, const QString &displayName);
+    static void removeDocument(DiffEditorDocument *document);
 
 private slots:
     void slotEditorsClosed(const QList<Core::IEditor *> &editors);
diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp
index fc88e8fffd677c137661d05f1e9d87de503aef16..3c48515d105190ab1eec7864f1d941c4cc0da04c 100644
--- a/src/plugins/diffeditor/diffeditorplugin.cpp
+++ b/src/plugins/diffeditor/diffeditorplugin.cpp
@@ -54,8 +54,7 @@ class SimpleDiffEditorReloader : public DiffEditorReloader
 {
     Q_OBJECT
 public:
-    SimpleDiffEditorReloader(QObject *parent,
-                             const QString &leftFileName,
+    SimpleDiffEditorReloader(const QString &leftFileName,
                              const QString &rightFileName);
 
 protected:
@@ -66,11 +65,9 @@ private:
     QString m_rightFileName;
 };
 
-SimpleDiffEditorReloader::SimpleDiffEditorReloader(QObject *parent,
-                                                   const QString &leftFileName,
+SimpleDiffEditorReloader::SimpleDiffEditorReloader(const QString &leftFileName,
                                                    const QString &rightFileName)
-    : DiffEditorReloader(parent),
-      m_leftFileName(leftFileName),
+    : m_leftFileName(leftFileName),
       m_rightFileName(rightFileName)
 {
 }
@@ -206,7 +203,7 @@ void DiffEditorPlugin::diff()
     DiffEditorController *controller = document->controller();
     if (!controller->reloader()) {
         SimpleDiffEditorReloader *reloader =
-                new SimpleDiffEditorReloader(controller, fileName1, fileName2);
+                new SimpleDiffEditorReloader(fileName1, fileName2);
         controller->setReloader(reloader);
     }
 
@@ -475,7 +472,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
     QCOMPARE(result, patchText);
 
     bool ok;
-    QList<FileData> resultList = DiffUtils::readPatch(result, false, &ok);
+    QList<FileData> resultList = DiffUtils::readPatch(result, &ok);
 
     QVERIFY(ok);
     QCOMPARE(resultList.count(), 1);
@@ -905,7 +902,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
     QFETCH(QList<FileData>, fileDataList);
 
     bool ok;
-    QList<FileData> result = DiffUtils::readPatch(sourcePatch, false, &ok);
+    QList<FileData> result = DiffUtils::readPatch(sourcePatch, &ok);
 
     QVERIFY(ok);
     QCOMPARE(fileDataList.count(), result.count());
diff --git a/src/plugins/diffeditor/diffeditorreloader.cpp b/src/plugins/diffeditor/diffeditorreloader.cpp
index 78fd9bf8d1d07738dcae8189731e04e710fdcda1..88bc93795a6fdbdd5c54a85ad15450fb340a0102 100644
--- a/src/plugins/diffeditor/diffeditorreloader.cpp
+++ b/src/plugins/diffeditor/diffeditorreloader.cpp
@@ -33,9 +33,8 @@
 
 namespace DiffEditor {
 
-DiffEditorReloader::DiffEditorReloader(QObject *parent)
-    : QObject(parent),
-      m_controller(0),
+DiffEditorReloader::DiffEditorReloader()
+    : m_controller(0),
       m_reloading(false)
 {
 }
diff --git a/src/plugins/diffeditor/diffeditorreloader.h b/src/plugins/diffeditor/diffeditorreloader.h
index 918a213eeb0595e8466e92b25378753cbd2075b0..11e593a214ddefb3adde3689a97d895e81c55696 100644
--- a/src/plugins/diffeditor/diffeditorreloader.h
+++ b/src/plugins/diffeditor/diffeditorreloader.h
@@ -43,7 +43,7 @@ class DIFFEDITOR_EXPORT DiffEditorReloader : public QObject
 {
     Q_OBJECT
 public:
-    DiffEditorReloader(QObject *parent = 0);
+    DiffEditorReloader();
     ~DiffEditorReloader();
 
     bool isReloading() const;
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index 589c4ddb84e0b377bef4c1f7d9999b9dcb4d9ed8..3f9c43a20de59455b7c26019fab78c7444e83fa0 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -517,7 +517,6 @@ QString DiffUtils::makePatch(const QList<FileData> &fileDataList)
 }
 
 static QList<RowData> readLines(const QString &patch,
-                                bool ignoreWhitespace,
                                 bool lastChunk,
                                 bool *lastChunkAtTheEndOfFile,
                                 bool *ok)
@@ -678,28 +677,16 @@ static QList<RowData> readLines(const QString &patch,
     QList<Diff> outputLeftDiffList;
     QList<Diff> outputRightDiffList;
 
-    if (ignoreWhitespace) {
-        const QList<Diff> leftIntermediate =
-                Differ::moveWhitespaceIntoEqualities(leftDiffList);
-        const QList<Diff> rightIntermediate =
-                Differ::moveWhitespaceIntoEqualities(rightDiffList);
-        Differ::ignoreWhitespaceBetweenEqualities(leftIntermediate,
-                                                  rightIntermediate,
-                                                  &outputLeftDiffList,
-                                                  &outputRightDiffList);
-    } else {
-        Differ::diffBetweenEqualities(leftDiffList,
-                                      rightDiffList,
-                                      &outputLeftDiffList,
-                                      &outputRightDiffList);
-    }
+    Differ::diffBetweenEqualities(leftDiffList,
+                                  rightDiffList,
+                                  &outputLeftDiffList,
+                                  &outputRightDiffList);
 
     return DiffUtils::calculateOriginalData(outputLeftDiffList,
                                             outputRightDiffList).rows;
 }
 
 static QList<ChunkData> readChunks(const QString &patch,
-                                   bool ignoreWhitespace,
                                    bool *lastChunkAtTheEndOfFile,
                                    bool *ok)
 {
@@ -728,7 +715,6 @@ static QList<ChunkData> readChunks(const QString &patch,
                 const QString lines = patch.mid(endOfLastChunk,
                                                 pos - endOfLastChunk);
                 chunkDataList.last().rows = readLines(lines,
-                                                      ignoreWhitespace,
                                                       false,
                                                       lastChunkAtTheEndOfFile,
                                                       &readOk);
@@ -747,7 +733,6 @@ static QList<ChunkData> readChunks(const QString &patch,
         if (endOfLastChunk > 0) {
             const QString lines = patch.mid(endOfLastChunk);
             chunkDataList.last().rows = readLines(lines,
-                                                  ignoreWhitespace,
                                                   true,
                                                   lastChunkAtTheEndOfFile,
                                                   &readOk);
@@ -761,7 +746,6 @@ static QList<ChunkData> readChunks(const QString &patch,
 }
 
 static FileData readDiffHeaderAndChunks(const QString &headerAndChunks,
-                                        bool ignoreWhitespace,
                                         bool *ok)
 {
     QString patch = headerAndChunks;
@@ -789,7 +773,6 @@ static FileData readDiffHeaderAndChunks(const QString &headerAndChunks,
             fileData.rightFileInfo.fileName = rightFileRegExp.cap(1);
 
             fileData.chunks = readChunks(patch,
-                                         ignoreWhitespace,
                                          &fileData.lastChunkAtTheEndOfFile,
                                          &readOk);
         }
@@ -811,7 +794,6 @@ static FileData readDiffHeaderAndChunks(const QString &headerAndChunks,
 }
 
 static QList<FileData> readDiffPatch(const QString &patch,
-                                     bool ignoreWhitespace,
                                      bool *ok)
 {
     const QRegExp diffRegExp(QLatin1String("(?:\\n|^)"          // new line of the beginning of a patch
@@ -844,7 +826,6 @@ static QList<FileData> readDiffPatch(const QString &patch,
                                                           pos - lastPos);
 
                 const FileData fileData = readDiffHeaderAndChunks(headerAndChunks,
-                                                                  ignoreWhitespace,
                                                                   &readOk);
 
                 if (!readOk)
@@ -861,7 +842,6 @@ static QList<FileData> readDiffPatch(const QString &patch,
                                                       patch.count() - lastPos - 1);
 
             const FileData fileData = readDiffHeaderAndChunks(headerAndChunks,
-                                                              ignoreWhitespace,
                                                               &readOk);
 
             if (readOk)
@@ -880,7 +860,6 @@ static QList<FileData> readDiffPatch(const QString &patch,
 
 static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
                                        const QString &fileName,
-                                       bool ignoreWhitespace,
                                        bool *ok)
 {
     FileData fileData;
@@ -944,7 +923,6 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks,
             patch.remove(0, rightFileRegExp.matchedLength());
 
             fileData.chunks = readChunks(patch,
-                                         ignoreWhitespace,
                                          &fileData.lastChunkAtTheEndOfFile,
                                          &readOk);
         }
@@ -966,7 +944,6 @@ static FileData readCopyRenameChunks(const QString &copyRenameChunks,
                                      FileData::FileOperation fileOperation,
                                      const QString &leftFileName,
                                      const QString &rightFileName,
-                                     bool ignoreWhitespace,
                                      bool *ok)
 {
     FileData fileData;
@@ -1005,7 +982,6 @@ static FileData readCopyRenameChunks(const QString &copyRenameChunks,
                     patch.remove(0, rightFileRegExp.matchedLength());
 
                     fileData.chunks = readChunks(patch,
-                                                 ignoreWhitespace,
                                                  &fileData.lastChunkAtTheEndOfFile,
                                                  &readOk);
                 }
@@ -1024,7 +1000,7 @@ static FileData readCopyRenameChunks(const QString &copyRenameChunks,
     return fileData;
 }
 
-static QList<FileData> readGitPatch(const QString &patch, bool ignoreWhitespace, bool *ok)
+static QList<FileData> readGitPatch(const QString &patch, bool *ok)
 {
     const QRegExp simpleGitRegExp(QLatin1String("(?:\\n|^)diff --git a/([^\\n]+) b/\\1\\n")); // diff --git a/cap1 b/cap1
 
@@ -1074,14 +1050,12 @@ static QList<FileData> readGitPatch(const QString &patch, bool ignoreWhitespace,
                 if (lastOperation == FileData::ChangeFile) {
                     fileData = readGitHeaderAndChunks(headerAndChunks,
                                                       lastLeftFileName,
-                                                      ignoreWhitespace,
                                                       &readOk);
                 } else {
                     fileData = readCopyRenameChunks(headerAndChunks,
                                                     lastOperation,
                                                     lastLeftFileName,
                                                     lastRightFileName,
-                                                    ignoreWhitespace,
                                                     &readOk);
                 }
                 if (!readOk)
@@ -1124,14 +1098,12 @@ static QList<FileData> readGitPatch(const QString &patch, bool ignoreWhitespace,
 
                 fileData = readGitHeaderAndChunks(headerAndChunks,
                                                   lastLeftFileName,
-                                                  ignoreWhitespace,
                                                   &readOk);
             } else {
                 fileData = readCopyRenameChunks(headerAndChunks,
                                                 lastOperation,
                                                 lastLeftFileName,
                                                 lastRightFileName,
-                                                ignoreWhitespace,
                                                 &readOk);
             }
             if (readOk)
@@ -1148,7 +1120,7 @@ static QList<FileData> readGitPatch(const QString &patch, bool ignoreWhitespace,
     return fileDataList;
 }
 
-QList<FileData> DiffUtils::readPatch(const QString &patch, bool ignoreWhitespace, bool *ok)
+QList<FileData> DiffUtils::readPatch(const QString &patch, bool *ok)
 {
     bool readOk = false;
 
@@ -1161,9 +1133,9 @@ QList<FileData> DiffUtils::readPatch(const QString &patch, bool ignoreWhitespace
     if (pos != -1)
         croppedPatch = patch.left(pos + 1); // crop the ending for git format-patch
 
-    fileDataList = readGitPatch(croppedPatch, ignoreWhitespace, &readOk);
+    fileDataList = readGitPatch(croppedPatch, &readOk);
     if (!readOk)
-        fileDataList = readDiffPatch(croppedPatch, ignoreWhitespace, &readOk);
+        fileDataList = readDiffPatch(croppedPatch, &readOk);
 
     if (ok)
         *ok = readOk;
diff --git a/src/plugins/diffeditor/diffutils.h b/src/plugins/diffeditor/diffutils.h
index c1e3dd9e6ff4cd993b894545bbb369fc06ef4b9e..bb0d3ed0d486d0b838b52d96f968dc75d2c1e576 100644
--- a/src/plugins/diffeditor/diffutils.h
+++ b/src/plugins/diffeditor/diffutils.h
@@ -148,7 +148,6 @@ public:
                              bool lastChunk = false);
     static QString makePatch(const QList<FileData> &fileDataList);
     static QList<FileData> readPatch(const QString &patch,
-                                     bool ignoreWhitespace,
                                      bool *ok = 0);
 };
 
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 1f559109d755d065cffa4956285ddfc39e61605c..fcdfbf43ea4db1e3f7d443f0054d70709aaee09b 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -331,8 +331,7 @@ void GitDiffHandler::slotTextualDiffOutputReceived(const QString &contents)
 
     bool ok;
     QList<DiffEditor::FileData> fileDataList
-            = DiffEditor::DiffUtils::readPatch(
-                contents, m_controller->isIgnoreWhitespace(), &ok);
+            = DiffEditor::DiffUtils::readPatch(contents, &ok);
     m_controller->setDiffFiles(fileDataList, m_workingDirectory);
     m_controller->requestRestoreState();
     deleteLater();
@@ -368,7 +367,7 @@ public:
         DiffShow
     };
 
-    GitDiffEditorReloader(QObject *parent);
+    GitDiffEditorReloader();
     void setWorkingDirectory(const QString &workingDir) {
         m_workingDirectory = workingDir;
     }
@@ -408,9 +407,8 @@ private:
     QString m_displayName;
 };
 
-GitDiffEditorReloader::GitDiffEditorReloader(QObject *parent)
-    : DiffEditorReloader(parent),
-      m_gitClient(GitPlugin::instance()->gitClient())
+GitDiffEditorReloader::GitDiffEditorReloader()
+    : m_gitClient(GitPlugin::instance()->gitClient())
 {
 }
 
@@ -831,7 +829,7 @@ GitDiffEditorReloader *GitClient::findOrCreateDiffEditor(const QString &document
         connect(controller, SIGNAL(expandBranchesRequested(QString)),
                 this, SLOT(branchesForCommit(QString)));
 
-        reloader = new GitDiffEditorReloader(controller);
+        reloader = new GitDiffEditorReloader();
         controller->setReloader(reloader);
 
         reloader->setWorkingDirectory(workingDirectory);