Commit a3e1bb78 authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Port deprecated QProces::start method

parent 5b7ad6b9
......@@ -165,7 +165,7 @@ bool FileViewGitPlugin::beginRetrieval(const QString& directory)
// ----- find path below git base dir -----
QProcess process;
process.setWorkingDirectory(directory);
process.start(QLatin1String("git rev-parse --show-prefix"));
process.start("git", {"rev-parse", "--show-prefix"});
QString dirBelowBaseDir = "";
while (process.waitForReadyRead()) {
char buffer[512];
......@@ -177,7 +177,7 @@ bool FileViewGitPlugin::beginRetrieval(const QString& directory)
m_versionInfoHash.clear();
// ----- find files with special status -----
process.start(QLatin1String("git status --porcelain -z -u --ignored"));
process.start("git", {"status", "--porcelain", "-z", "-u", "--ignored"});
while (process.waitForReadyRead()) {
char buffer[1024];
while (readUntilZeroChar(&process, buffer, sizeof(buffer)) > 0 ) {
......@@ -592,7 +592,13 @@ void FileViewGitPlugin::commit()
tmpCommitMessageFile.close();
QProcess process;
process.setWorkingDirectory(m_contextDir);
process.start(QString("git commit") + (dialog.amend() ? " --amend" : "")+ " -F " + tmpCommitMessageFile.fileName());
QStringList args = {"commit"};
if (dialog.amend()) {
args << "--amend";
}
args << "-F";
args << tmpCommitMessageFile.fileName();
process.start("git", args);
QString completedMessage;
while (process.waitForReadyRead()){
char buffer[512];
......@@ -621,8 +627,7 @@ void FileViewGitPlugin::createTag()
QProcess process;
process.setWorkingDirectory(m_contextDir);
process.setReadChannel(QProcess::StandardError);
process.start(QString("git tag -a -F %1 %2 %3").arg(tempTagMessageFile.fileName()).
arg(dialog.tagName()).arg(dialog.baseBranch()));
process.start("git", {"tag", "-a", "-F", tempTagMessageFile.fileName(), dialog.tagName(), dialog.baseBranch()});
QString completedMessage;
bool gotTagAlreadyExistsMessage = false;
while (process.waitForReadyRead()) {
......@@ -684,7 +689,7 @@ void FileViewGitPlugin::pull()
m_command = "pull";
m_pendingOperation = true;
m_process.start(QString("git pull %1 %2").arg(dialog.source()).arg(dialog.remoteBranch()));
m_process.start("git", {"pull", dialog.source(), dialog.remoteBranch()});
}
}
......
......@@ -49,7 +49,7 @@ QString GitWrapper::userName()
{
QString result("");
char buffer[SMALL_BUFFER_SIZE];
m_process.start("git config --get user.name");
m_process.start("git", {"config", "--get", "user.name"});
while (m_process.waitForReadyRead()) {
if (m_process.readLine(buffer, sizeof(buffer)) > 0) {
result = m_localCodec->toUnicode(buffer).trimmed();
......@@ -62,7 +62,7 @@ QString GitWrapper::userEmail()
{
QString result("");
char buffer[SMALL_BUFFER_SIZE];
m_process.start("git config --get user.email");
m_process.start("git", {"config", "--get", "user.email"});
while (m_process.waitForReadyRead()) {
if (m_process.readLine(buffer, sizeof(buffer)) > 0) {
result = m_localCodec->toUnicode(buffer).trimmed();
......@@ -78,7 +78,7 @@ QStringList GitWrapper::branches(int* currentBranchIndex)
if (currentBranchIndex != 0) {
*currentBranchIndex = -1;
}
m_process.start(QLatin1String("git branch -a"));
m_process.start("git", {"branch", "-a"});
while (m_process.waitForReadyRead()) {
char buffer[BUFFER_SIZE];
while (m_process.readLine(buffer, sizeof(buffer)) > 0){
......@@ -97,7 +97,7 @@ QStringList GitWrapper::branches(int* currentBranchIndex)
void GitWrapper::tagSet(QSet<QString>& result)
{
m_process.start(QLatin1String("git tag"));
m_process.start("git", {"tag"});
while (m_process.waitForReadyRead()) {
char buffer[BUFFER_SIZE];
while (m_process.readLine(buffer, sizeof(buffer)) > 0){
......@@ -110,7 +110,7 @@ void GitWrapper::tagSet(QSet<QString>& result)
QStringList GitWrapper::tags()
{
QStringList result;
m_process.start(QLatin1String("git tag"));
m_process.start("git", {"tag"});
while (m_process.waitForReadyRead()) {
char buffer[BUFFER_SIZE];
while (m_process.readLine(buffer, sizeof(buffer)) > 0){
......@@ -124,7 +124,7 @@ QStringList GitWrapper::tags()
inline QStringList GitWrapper::remotes(QLatin1String lineEnd)
{
QStringList result;
m_process.start(QLatin1String("git remote -v"));
m_process.start("git", {"remote", "-v"});
while (m_process.waitForReadyRead()) {
char buffer[BUFFER_SIZE];
while (m_process.readLine(buffer, sizeof(buffer)) > 0){
......@@ -151,7 +151,7 @@ QString GitWrapper::lastCommitMessage()
{
QString result;
char buffer[BUFFER_SIZE];
m_process.start("git log -1");
m_process.start("git", {"log", "-1"});
while (m_process.waitForReadyRead()) {
bool inMessage = false;
QStringList message;
......
Markdown is supported
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