Gerrit: Inline two functions that are used just once

Change-Id: Iad49a785353203585342b61016df34105bc3a22e
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
hjk
2024-07-16 10:16:12 +02:00
parent 4d9bb822af
commit d8ccc0479d
3 changed files with 8 additions and 19 deletions

View File

@@ -3,6 +3,7 @@
#include "gerritparameters.h" #include "gerritparameters.h"
#include "gerritplugin.h" #include "gerritplugin.h"
#include "../gitclient.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -40,7 +41,7 @@ static FilePath detectApp(const QString &defaultExe)
if (!app.isEmpty() || !HostOsInfo::isWindowsHost()) if (!app.isEmpty() || !HostOsInfo::isWindowsHost())
return FilePath::fromString(app); return FilePath::fromString(app);
// Windows: Use app.exe from git if it cannot be found. // Windows: Use app.exe from git if it cannot be found.
const FilePath gitBinDir = GerritPlugin::gitBinDirectory(); const FilePath gitBinDir = Git::Internal::gitClient().gitBinDirectory();
if (gitBinDir.isEmpty()) if (gitBinDir.isEmpty())
return {}; return {};
FilePath path = gitBinDir.pathAppended(defaultApp); FilePath path = gitBinDir.pathAppended(defaultApp);

View File

@@ -39,12 +39,12 @@ using namespace Git::Internal;
enum { debug = 0 }; enum { debug = 0 };
namespace Gerrit { namespace Gerrit::Internal {
namespace Constants { namespace Constants {
const char GERRIT_OPEN_VIEW[] = "Gerrit.OpenView"; const char GERRIT_OPEN_VIEW[] = "Gerrit.OpenView";
const char GERRIT_PUSH[] = "Gerrit.Push"; const char GERRIT_PUSH[] = "Gerrit.Push";
} }
namespace Internal {
enum FetchMode enum FetchMode
{ {
@@ -263,17 +263,6 @@ void GerritPlugin::push()
push(currentRepository()); push(currentRepository());
} }
Utils::FilePath GerritPlugin::gitBinDirectory()
{
return gitClient().gitBinDirectory();
}
// Find the branch of a repository.
QString GerritPlugin::branch(const FilePath &repository)
{
return gitClient().synchronousCurrentLocalBranch(repository);
}
void GerritPlugin::fetch(const std::shared_ptr<GerritChange> &change, int mode) void GerritPlugin::fetch(const std::shared_ptr<GerritChange> &change, int mode)
{ {
// Locate git. // Locate git.
@@ -385,7 +374,9 @@ FilePath GerritPlugin::findLocalRepository(const QString &project, const QString
if (branch.isEmpty()) { if (branch.isEmpty()) {
return repository; return repository;
} else { } else {
const QString repositoryBranch = GerritPlugin::branch(repository); // Find the branch of a repository.
const QString repositoryBranch =
gitClient().synchronousCurrentLocalBranch(repository);
if (repositoryBranch.isEmpty() || repositoryBranch == branch) if (repositoryBranch.isEmpty() || repositoryBranch == branch)
return repository; return repository;
} // !branch.isEmpty() } // !branch.isEmpty()
@@ -398,7 +389,6 @@ FilePath GerritPlugin::findLocalRepository(const QString &project, const QString
return FilePath::currentWorkingPath(); return FilePath::currentWorkingPath();
} }
} // namespace Internal } // Gerrit::Internal
} // namespace Gerrit
#include "gerritplugin.moc" #include "gerritplugin.moc"

View File

@@ -34,8 +34,6 @@ public:
void addToMenu(Core::ActionContainer *ac); void addToMenu(Core::ActionContainer *ac);
static Utils::FilePath gitBinDirectory();
static QString branch(const Utils::FilePath &repository);
void addToLocator(Core::CommandLocator *locator); void addToLocator(Core::CommandLocator *locator);
void push(const Utils::FilePath &topLevel); void push(const Utils::FilePath &topLevel);