From 1decef8fc98e156338d9a558bd089dcd1224c414 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 6 Jan 2018 22:28:05 +0200 Subject: [PATCH] Gerrit: Deduplicate detection of current repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib3a63f71dd45c45b20eab51a2a0bf9c21ba8754a Reviewed-by: André Hartmann Reviewed-by: Eike Ziller --- src/plugins/git/gerrit/gerritplugin.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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()