Commit dcff3cca authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

use setupGitProcess consistent

parent d55325e7
Pipeline #200258 passed with stage
in 8 minutes and 3 seconds
......@@ -14,7 +14,8 @@
#include <KTextEditor/MainWindow>
#include <KTextEditor/View>
#include "hostprocess.h"
#include <gitprocess.h>
#include <hostprocess.h>
#include <ktexteditor_utils.h>
PushPullDialog::PushPullDialog(KTextEditor::MainWindow *mainWindow, const QString &repoPath)
......@@ -101,28 +102,28 @@ void PushPullDialog::saveCommand(const QString &command)
static QString currentBranchName(const QString &repo)
{
QProcess git;
git.setWorkingDirectory(repo);
QStringList args{QStringLiteral("symbolic-ref"), QStringLiteral("--short"), QStringLiteral("HEAD")};
if (!setupGitProcess(git, repo, {QStringLiteral("symbolic-ref"), QStringLiteral("--short"), QStringLiteral("HEAD")})) {
return {};
}
startHostProcess(git, QStringLiteral("git"), args, QProcess::ReadOnly);
startHostProcess(git, QIODevice::ReadOnly);
if (git.waitForStarted() && git.waitForFinished(-1)) {
if (git.exitStatus() == QProcess::NormalExit && git.exitCode() == 0) {
return QString::fromUtf8(git.readAllStandardOutput().trimmed());
}
}
// give up
return QString();
return {};
}
static QStringList remotesList(const QString &repo)
{
QProcess git;
git.setWorkingDirectory(repo);
QStringList args{QStringLiteral("remote")};
if (!setupGitProcess(git, repo, {QStringLiteral("remote")})) {
return {};
}
startHostProcess(git, QStringLiteral("git"), args, QProcess::ReadOnly);
startHostProcess(git, QIODevice::ReadOnly);
if (git.waitForStarted() && git.waitForFinished(-1)) {
if (git.exitStatus() == QProcess::NormalExit && git.exitCode() == 0) {
return QString::fromUtf8(git.readAllStandardOutput()).split(QLatin1Char('\n'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment