forked from qt-creator/qt-creator
Git: Initialize GitClient on first access
This does not change the current timing of construction a lot as
the GerritPlugin may need it immediately in some cases, in any
case the gitGrep instance will need it.
There's nothing big going on at destruction time, so the prolonged
lifetime until really close to the end does not hurt.
The reason here is that this way we will avoid cases like in change
5e5b90a9a1.
Change-Id: I326d83c1a3d21114322ac6cce8d9e9b782faacdc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -246,13 +246,13 @@ void GitLabProjectSettingsWidget::updateUi()
|
||||
}
|
||||
|
||||
const Utils::FilePath projectDirectory = m_projectSettings->project()->projectDirectory();
|
||||
const auto *gitClient = Git::Internal::GitClient::instance();
|
||||
const Utils::FilePath repository = gitClient
|
||||
? gitClient->findRepositoryForDirectory(projectDirectory) : Utils::FilePath();
|
||||
const Utils::FilePath repository =
|
||||
Git::Internal::gitClient().findRepositoryForDirectory(projectDirectory);
|
||||
|
||||
m_hostCB->clear();
|
||||
if (!repository.isEmpty()) {
|
||||
const QMap<QString, QString> remotes = gitClient->synchronousRemotesList(repository);
|
||||
const QMap<QString, QString> remotes =
|
||||
Git::Internal::gitClient().synchronousRemotesList(repository);
|
||||
for (auto it = remotes.begin(), end = remotes.end(); it != end; ++it) {
|
||||
const QString display = it.key() + " (" + it.value() + ')';
|
||||
m_hostCB->addItem(display, QVariant::fromValue(it.value()));
|
||||
@@ -291,9 +291,8 @@ void GitLabProjectSettingsWidget::updateEnabledStates()
|
||||
m_checkConnection->setEnabled(isGitRepository && hasGitLabServers);
|
||||
if (!isGitRepository) {
|
||||
const Utils::FilePath projectDirectory = m_projectSettings->project()->projectDirectory();
|
||||
const auto *gitClient = Git::Internal::GitClient::instance();
|
||||
const Utils::FilePath repository = gitClient
|
||||
? gitClient->findRepositoryForDirectory(projectDirectory) : Utils::FilePath();
|
||||
const Utils::FilePath repository =
|
||||
Git::Internal::gitClient().findRepositoryForDirectory(projectDirectory);
|
||||
if (repository.isEmpty())
|
||||
m_infoLabel->setText(Tr::tr("Not a git repository."));
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user