diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 94983d7f872..66a776fa0b6 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -8,8 +8,10 @@ #include #include +#include #include #include +#include #include #include @@ -886,9 +888,17 @@ void BranchModel::updateUpstreamStatus(BranchNode *node) { if (node->tracking.isEmpty()) return; - VcsCommand *command = d->client->asyncUpstreamStatus( - d->workingDirectory, node->fullRef(), node->tracking); - QObject::connect(command, &VcsCommand::stdOutText, node, [this, node](const QString &text) { + + QtcProcess *process = new QtcProcess(node); + process->setEnvironment(d->client->processEnvironment()); + process->setCommand({d->client->vcsBinary(), {"rev-list", "--no-color", "--left-right", + "--count", node->fullRef() + "..." + node->tracking}}); + process->setWorkingDirectory(d->workingDirectory); + connect(process, &QtcProcess::done, this, [this, process, node] { + process->deleteLater(); + if (process->result() != ProcessResult::FinishedWithSuccess) + return; + const QString text = process->cleanedStdOut(); if (text.isEmpty()) return; const QStringList split = text.trimmed().split('\t'); @@ -898,6 +908,7 @@ void BranchModel::updateUpstreamStatus(BranchNode *node) const QModelIndex idx = nodeToIndex(node, ColumnBranch); emit dataChanged(idx, idx); }); + process->start(); } QString BranchModel::toolTip(const QString &sha) const diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 757c5cb6e49..0d7136b7290 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -3166,15 +3166,6 @@ bool GitClient::synchronousSetTrackingBranch(const FilePath &workingDirectory, return result.result() == ProcessResult::FinishedWithSuccess; } -VcsCommand *GitClient::asyncUpstreamStatus(const FilePath &workingDirectory, - const QString &branch, - const QString &upstream) -{ - const QStringList args {"rev-list", noColorOption, "--left-right", "--count", - branch + "..." + upstream}; - return vcsExec(workingDirectory, args, nullptr, false, VcsCommand::NoOutput); -} - void GitClient::handleMergeConflicts(const FilePath &workingDir, const QString &commit, const QStringList &files, const QString &abortCommand) { diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index fd7b605ebbd..ac07e515929 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -332,9 +332,6 @@ public: void show(const QString &source, const QString &id, const QString &name = {}); void archive(const Utils::FilePath &workingDirectory, QString commit); - VcsBase::VcsCommand *asyncUpstreamStatus(const Utils::FilePath &workingDirectory, - const QString &branch, const QString &upstream); - enum class BranchTargetType { Remote, Commit }; static QString suggestedLocalBranchName( const Utils::FilePath &workingDirectory, const QStringList &existingLocalNames,