forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user