forked from qt-creator/qt-creator
Advanced search: Add exclusion patterns
All files with full file path matching one of the exclusion patterns are ignored in the search. Searching with "git grep" now requires git >= 1.9 Change-Id: Ied5d11499bc1ff21247e50f8e146e8e5011dd2c1 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <vcsbase/vcscommand.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/filesearch.h>
|
||||
@@ -159,7 +160,14 @@ public:
|
||||
arguments << params.ref;
|
||||
m_ref = params.ref + ':';
|
||||
}
|
||||
arguments << "--" << m_parameters.nameFilters;
|
||||
const QStringList filterArgs =
|
||||
m_parameters.nameFilters.isEmpty() ? QStringList("*") // needed for exclusion filters
|
||||
: m_parameters.nameFilters;
|
||||
const QStringList exclusionArgs =
|
||||
Utils::transform(m_parameters.exclusionFilters, [](const QString &filter) {
|
||||
return QString(":!" + filter);
|
||||
});
|
||||
arguments << "--" << filterArgs << exclusionArgs;
|
||||
QScopedPointer<VcsCommand> command(GitPlugin::client()->createCommand(m_directory));
|
||||
command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage);
|
||||
command->setProgressiveOutput(true);
|
||||
|
||||
Reference in New Issue
Block a user