GitClient: fix diff when committing

When a commit has several files, opening diff for the first file
works, but trying to open another diff without closing the previous
one doesn't refresh the diff editor.

Change-Id: Ia973cb70f2355a89b70787dd97042ef9f751d9d6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
This commit is contained in:
Nikita Baryshnikov
2015-04-09 11:36:32 +03:00
parent 7da95de7b2
commit 1d23de641f
2 changed files with 6 additions and 11 deletions

View File

@@ -48,7 +48,6 @@ DiffEditorController::DiffEditorController(Core::IDocument *document) :
m_chunkIndex(-1)
{
QTC_ASSERT(m_document, return);
QTC_CHECK(!m_document->controller());
m_document->setController(this);
}

View File

@@ -792,19 +792,15 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
const QString &title,
std::function<DiffEditorController *(IDocument *)> factory) const
{
DiffEditorController *controller = 0;
IDocument *document = DiffEditorManager::findOrCreate(documentId, title);
QTC_ASSERT(document, return);
controller = DiffEditorManager::controller(document);
if (!controller) {
controller = factory(document);
QTC_ASSERT(controller, return);
DiffEditorController *controller = factory(document);
QTC_ASSERT(controller, return);
connect(controller, &DiffEditorController::chunkActionsRequested,
this, &GitClient::slotChunkActionsRequested, Qt::DirectConnection);
connect(controller, &DiffEditorController::requestInformationForCommit,
this, &GitClient::branchesForCommit);
}
connect(controller, &DiffEditorController::chunkActionsRequested,
this, &GitClient::slotChunkActionsRequested, Qt::DirectConnection);
connect(controller, &DiffEditorController::requestInformationForCommit,
this, &GitClient::branchesForCommit);
VcsBasePlugin::setSource(document, source);
EditorManager::activateEditorForDocument(document);