TextSearch: in text only mode, disable grep file type checking

Without, grep would do its own file type check, which could clash
with the one done by our own FileIterator, based on MIME type.
Improve a bit overall performance.

Change-Id: Ib0ef814e89b076b93e2e7b215f079cad8137128f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10630
Reviewed-by: nephele nephele <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Philippe Houdoin
2026-04-02 12:17:16 +00:00
parent dc2b843979
commit cbad2174a9
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -94,8 +94,8 @@ Grepper::Grepper(const char* pattern, const char* glob, const Model* model,
fTarget(target),
fRegularExpression(model->fRegularExpression),
fCaseSensitive(model->fCaseSensitive),
fTextOnly(model->fTextOnly),
fEncoding(model->fEncoding),
fIterator(iterator),
fRunnerThreadId(-1),
fXargsInput(-1),
@@ -270,6 +270,11 @@ Grepper::_RunnerThread()
argv[argc++] = "grep";
argv[argc++] = "-n"; // need matching line(s) number(s)
argv[argc++] = "-H"; // need filename prefix
if (fTextOnly) {
// assume all files are already checked as text files by Files Iterator
// so don't let grep consider any of them as binary file
argv[argc++] = "--text";
}
if (! fCaseSensitive)
argv[argc++] = "-i";
if (! fRegularExpression)
+1
View File
@@ -49,6 +49,7 @@ private:
BMessenger fTarget;
bool fRegularExpression : 1;
bool fCaseSensitive : 1;
bool fTextOnly : 1;
uint32 fEncoding;
// The supplier of files to grep