diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index ba644b6530f..e495ff57483 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -349,6 +349,11 @@ void GerritPlugin::push(const QString &topLevel) GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), target}); } +static QString currentRepository() +{ + return GitPlugin::instance()->currentState().topLevel(); +} + // Open or raise the Gerrit dialog window. void GerritPlugin::openView() { @@ -359,8 +364,7 @@ void GerritPlugin::openView() if (!ICore::showOptionsDialog("Gerrit")) return; } - const QString repository = GitPlugin::instance()->currentState().topLevel(); - GerritDialog *gd = new GerritDialog(m_parameters, m_server, repository, ICore::mainWindow()); + GerritDialog *gd = new GerritDialog(m_parameters, m_server, currentRepository(), ICore::mainWindow()); gd->setModal(false); connect(gd, &GerritDialog::fetchDisplay, this, [this](const QSharedPointer &change) { fetch(change, FetchDisplay); }); @@ -383,7 +387,7 @@ void GerritPlugin::openView() void GerritPlugin::push() { - push(GitPlugin::instance()->currentState().topLevel()); + push(currentRepository()); } Utils::FileName GerritPlugin::gitBinDirectory()