diff options
author | hjk <hjk@qt.io> | 2019-07-23 10:17:57 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-23 15:51:45 +0000 |
commit | 8b72e9216746c04e68a1c6498ac3396942fbebce (patch) | |
tree | c8742f1cf932ec3fae5a3f6476b390dbeb06ec9e /src/plugins/git | |
parent | 80716610c5f4deb32af15f1189363bf2ebffa41e (diff) | |
download | qt-creator-8b72e9216746c04e68a1c6498ac3396942fbebce.tar.gz |
Utils: Add CommandLine convenience constructors
... taking a QString for the executable.
This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.
I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.
Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/git')
-rw-r--r-- | src/plugins/git/gerrit/gerritmodel.cpp | 3 | ||||
-rw-r--r-- | src/plugins/git/gerrit/gerritserver.cpp | 6 | ||||
-rw-r--r-- | src/plugins/git/gitclient.cpp | 7 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index 0e6fcac3d5..945f2b1619 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -314,8 +314,7 @@ void QueryContext::start() fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish); m_progress.reportStarted(); // Order: synchronous call to error handling if something goes wrong. - VcsOutputWindow::appendCommand( - m_process.workingDirectory(), {Utils::FilePath::fromString(m_binary), m_arguments}); + VcsOutputWindow::appendCommand(m_process.workingDirectory(), {m_binary, m_arguments}); m_timer.start(); m_process.start(m_binary, m_arguments); m_process.closeWriteChannel(); diff --git a/src/plugins/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp index 327ccf565b..f642b1f9d6 100644 --- a/src/plugins/git/gerrit/gerritserver.cpp +++ b/src/plugins/git/gerrit/gerritserver.cpp @@ -243,7 +243,7 @@ int GerritServer::testConnection() static GitClient *const client = GitPlugin::client(); const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC); const SynchronousProcessResponse resp = client->vcsFullySynchronousExec( - QString(), {FilePath::fromString(curlBinary), arguments}, + QString(), {curlBinary, arguments}, Core::ShellCommand::NoOutput); if (resp.result == SynchronousProcessResponse::Finished) { QString output = resp.stdOut(); @@ -345,7 +345,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload) arguments << p.portFlag << QString::number(port); arguments << hostArgument() << "gerrit" << "version"; const SynchronousProcessResponse resp = client->vcsFullySynchronousExec( - QString(), {FilePath::fromString(p.ssh), arguments}, + QString(), {p.ssh, arguments}, Core::ShellCommand::NoOutput); QString stdOut = resp.stdOut().trimmed(); stdOut.remove("gerrit version "); @@ -353,7 +353,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload) } else { const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC); const SynchronousProcessResponse resp = client->vcsFullySynchronousExec( - QString(), {FilePath::fromString(curlBinary), arguments}, + QString(), {curlBinary, arguments}, Core::ShellCommand::NoOutput); // REST endpoint for version is only available from 2.8 and up. Do not consider invalid // if it fails. diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c57a291ac1..44f4d35f88 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1369,7 +1369,8 @@ bool GitClient::synchronousReset(const QString &workingDirectory, // Initialize repository bool GitClient::synchronousInit(const QString &workingDirectory) { - const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, {"init"}); + const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, + QStringList{"init"}); // '[Re]Initialized...' VcsOutputWindow::append(resp.stdOut()); if (resp.result == SynchronousProcessResponse::Finished) { @@ -1581,7 +1582,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const // No tag or remote branch - try git describe const SynchronousProcessResponse resp = - vcsFullySynchronousExec(workingDirectory, {"describe"}, VcsCommand::NoOutput); + vcsFullySynchronousExec(workingDirectory, QStringList{"describe"}, VcsCommand::NoOutput); if (resp.result == SynchronousProcessResponse::Finished) { const QString stdOut = resp.stdOut().trimmed(); if (!stdOut.isEmpty()) @@ -2422,7 +2423,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs())); if (!fileName.isEmpty()) arguments << "--" << fileName; - VcsOutputWindow::appendCommand(workingDirectory, {FilePath::fromString(binary), arguments}); + VcsOutputWindow::appendCommand(workingDirectory, {binary, arguments}); // This should always use QProcess::startDetached (as not to kill // the child), but that does not have an environment parameter. bool success = false; |