Git: Minor cleanup in grep

Change-Id: I2a686b6f56947d3fbb6dc70757e539bf4f274bff
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2017-07-23 08:01:16 +03:00
committed by Orgad Shaneh
parent 561a50e3a1
commit f073c39b86

View File

@@ -141,11 +141,11 @@ public:
void exec() void exec()
{ {
QStringList arguments; GitClient *client = GitPlugin::client();
arguments << "-c" << "color.grep.match=bold red" QStringList arguments = {
<< "grep" << "-zn" "-c", "color.grep.match=bold red",
<< "--no-full-name" "grep", "-zn", "--no-full-name", "--color=always"
<< "--color=always"; };
if (!(m_parameters.flags & FindCaseSensitively)) if (!(m_parameters.flags & FindCaseSensitively))
arguments << "-i"; arguments << "-i";
if (m_parameters.flags & FindWholeWords) if (m_parameters.flags & FindWholeWords)
@@ -168,7 +168,7 @@ public:
return QString(":!" + filter); return QString(":!" + filter);
}); });
arguments << "--" << filterArgs << exclusionArgs; arguments << "--" << filterArgs << exclusionArgs;
QScopedPointer<VcsCommand> command(GitPlugin::client()->createCommand(m_directory)); QScopedPointer<VcsCommand> command(client->createCommand(m_directory));
command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage); command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage);
command->setProgressiveOutput(true); command->setProgressiveOutput(true);
QFutureWatcher<FileSearchResultList> watcher; QFutureWatcher<FileSearchResultList> watcher;
@@ -176,7 +176,7 @@ public:
connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled, connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled,
command.data(), &VcsCommand::cancel); command.data(), &VcsCommand::cancel);
connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read); connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read);
SynchronousProcessResponse resp = command->runCommand(GitPlugin::client()->vcsBinary(), arguments, 0); SynchronousProcessResponse resp = command->runCommand(client->vcsBinary(), arguments, 0);
switch (resp.result) { switch (resp.result) {
case SynchronousProcessResponse::TerminatedAbnormally: case SynchronousProcessResponse::TerminatedAbnormally:
case SynchronousProcessResponse::StartFailed: case SynchronousProcessResponse::StartFailed: