forked from qt-creator/qt-creator
Git: Fix source repository resolution in Stashes dialog
Remove workaround done in Branches and store copies where they're needed. Task-number: QTCREATORBUG-14850 Change-Id: I6a81fc5ac02fb11d444906af6cfbe768695c9965 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
d7c5ee7edd
commit
786aa4a441
@@ -316,8 +316,7 @@ void BranchDialog::diff()
|
|||||||
QString fullName = m_model->fullName(selectedIndex(), true);
|
QString fullName = m_model->fullName(selectedIndex(), true);
|
||||||
if (fullName.isEmpty())
|
if (fullName.isEmpty())
|
||||||
return;
|
return;
|
||||||
// Do not pass working dir by reference since it might change
|
GitPlugin::instance()->client()->diffBranch(m_repository, fullName);
|
||||||
GitPlugin::instance()->client()->diffBranch(QString(m_repository), fullName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::log()
|
void BranchDialog::log()
|
||||||
@@ -325,8 +324,7 @@ void BranchDialog::log()
|
|||||||
QString branchName = m_model->fullName(selectedIndex(), true);
|
QString branchName = m_model->fullName(selectedIndex(), true);
|
||||||
if (branchName.isEmpty())
|
if (branchName.isEmpty())
|
||||||
return;
|
return;
|
||||||
// Do not pass working dir by reference since it might change
|
GitPlugin::instance()->client()->log(m_repository, QString(), false, QStringList(branchName));
|
||||||
GitPlugin::instance()->client()->log(QString(m_repository), QString(), false, QStringList(branchName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::reset()
|
void BranchDialog::reset()
|
||||||
|
|||||||
@@ -743,6 +743,9 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
|
|||||||
const QString &title,
|
const QString &title,
|
||||||
std::function<DiffEditorController *(IDocument *)> factory) const
|
std::function<DiffEditorController *(IDocument *)> factory) const
|
||||||
{
|
{
|
||||||
|
// Creating document might change the referenced source. Store a copy and use it.
|
||||||
|
const QString sourceCopy = source;
|
||||||
|
|
||||||
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
IDocument *document = DiffEditorController::findOrCreateDocument(documentId, title);
|
||||||
QTC_ASSERT(document, return);
|
QTC_ASSERT(document, return);
|
||||||
DiffEditorController *controller = factory(document);
|
DiffEditorController *controller = factory(document);
|
||||||
@@ -753,7 +756,7 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
|
|||||||
connect(controller, &DiffEditorController::requestInformationForCommit,
|
connect(controller, &DiffEditorController::requestInformationForCommit,
|
||||||
this, &GitClient::branchesForCommit);
|
this, &GitClient::branchesForCommit);
|
||||||
|
|
||||||
VcsBasePlugin::setSource(document, source);
|
VcsBasePlugin::setSource(document, sourceCopy);
|
||||||
EditorManager::activateEditorForDocument(document);
|
EditorManager::activateEditorForDocument(document);
|
||||||
controller->requestReload();
|
controller->requestReload();
|
||||||
}
|
}
|
||||||
@@ -843,19 +846,21 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
msgArg = args.first();
|
msgArg = args.first();
|
||||||
else
|
else
|
||||||
msgArg = workingDirectory;
|
msgArg = workingDirectory;
|
||||||
|
// Creating document might change the referenced workingDirectory. Store a copy and use it.
|
||||||
|
const QString workingDir = workingDirectory;
|
||||||
const QString title = tr("Git Log \"%1\"").arg(msgArg);
|
const QString title = tr("Git Log \"%1\"").arg(msgArg);
|
||||||
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
||||||
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
|
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
||||||
codecFor(CodecLogOutput), "logTitle", msgArg);
|
codecFor(CodecLogOutput), "logTitle", msgArg);
|
||||||
if (!editor->configurationWidget()) {
|
if (!editor->configurationWidget()) {
|
||||||
auto *argWidget = new GitLogArgumentsWidget(settings());
|
auto *argWidget = new GitLogArgumentsWidget(settings());
|
||||||
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
|
||||||
[=]() { this->log(workingDirectory, fileName, enableAnnotationContextMenu, args); });
|
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
||||||
editor->setConfigurationWidget(argWidget);
|
editor->setConfigurationWidget(argWidget);
|
||||||
}
|
}
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
editor->setWorkingDirectory(workingDirectory);
|
editor->setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("log") << QLatin1String(noColorOption)
|
arguments << QLatin1String("log") << QLatin1String(noColorOption)
|
||||||
@@ -874,7 +879,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
arguments << QLatin1String("--follow") << QLatin1String("--") << fileName;
|
arguments << QLatin1String("--follow") << QLatin1String("--") << fileName;
|
||||||
|
|
||||||
vcsExec(workingDirectory, arguments, editor);
|
vcsExec(workingDir, arguments, editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::reflog(const QString &workingDirectory)
|
void GitClient::reflog(const QString &workingDirectory)
|
||||||
|
|||||||
Reference in New Issue
Block a user