summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2019-01-29deprecated: remove use of ATOMIC_BOOL_INITAndrew Gallant
Our MSRV is high enough that we can use const functions now.
2019-01-26search: fix -F and -f interaction bugAndrew Gallant
This fixes what appears to be a pretty egregious regression where the `-F/--fixed-strings` flag wasn't be applied to patterns supplied via the `-f/--file` flag. The same bug existed for the `-x/--line-regexp` flag as well, which we fix here. Fixes #1176
2019-01-26exit: tweak exit status logicAndrew Gallant
This changes how ripgrep emit exit status codes. In particular, any error that occurs while searching will now cause ripgrep to emit a `2` exit code, where as it previously would emit either a `0` or a `1` code based on whether it matched or not. That is, ripgrep would only emit a `2` exit code for a catastrophic error. This tweak includes additional logic that GNU grep adheres to, which seems like good sense. Namely, if -q/--quiet is given, and an error occurs and a match occurs, then ripgrep will emit a `0` exit code. Closes #1159
2019-01-26args: prevent panicking in 'rg -h | rg'Andrew Gallant
Previously, we relied on clap to handle printing either an error message, or --help/--version output, in addition to setting the exit status code. Unfortunately, for --help/--version output, clap was panicking if the write failed, which can happen in fairly common scenarios via a broken pipe error. e.g., `rg -h | head`. We fix this by using clap's "safe" API and doing the printing ourselves. We also set the exit code to `2` when an invalid command has been given. Fixes #1125 and partially addresses #1159
2019-01-26doc: clarify automatic encoding detectionAndrew Gallant
Fixes #1103
2019-01-26fmt: shorten --ignore-file-case-insensitive descriptionAndrew Gallant
2019-01-26config: add --no-ignore-dot flagAndrew Gallant
This flag causes ripgrep to ignore `.ignore` files. Closes #1138
2019-01-23ripgrep: don't skip stdout in --files modeRob Lourens
Specifically, this avoids triggering Windows antimalware when in --files mode. See also #600. Fixes #1121
2019-01-22grep-cli: support Brotli/Zstd decompressiondana
Fixes #1099
2019-01-22ripgrep: add --ignore-file-case-insensitiveDavid Torosyan
The --ignore-file-case-insensitive flag causes all .gitignore/.rgignore/.ignore files to have their globs matched without regard for case. Because this introduces a potentially significant performance regression, this is always disabled by default. Users that need case insensitive matching can enable it on a case by case basis. Closes #1164, Closes #1170
2019-01-19edition: move core ripgrep to Rust 2018Andrew Gallant
2019-01-05doc: fix typoMarco Hinz
2018-11-06doc: escape braces in AsciiDocAndrew Gallant
This commit fixes a bug where AsciiDoc would drop any line containing a '{foo}' because it interpreted it as an undefined attribute reference: > Simple attribute references take the form {<name>}. If the attribute name > is defined its text value is substituted otherwise the line containing the > reference is dropped from the output. See: https://www.methods.co.nz/asciidoc/chunked/ch30.html We fix this by simply replacing all occurrences of '{' and '}' with their escaped forms: '&#123;' and '&#125;'. Fixes #1101
2018-09-25ripgrep: suggest -U/--multilineAndrew Gallant
When a "\n literal is not allowed" error is reported, ripgrep will now suggest the use of the -U/--multiline flag, which enables matching newlines. Fixes #1055
2018-09-10doc: fix typoGabe Berke-Williams
"cretion" -> "creation" PR #1045
2018-09-08pcre2: use jit_if_availablegrep-pcre2-0.1.2grep-0.2.3Andrew Gallant
This will allow PCRE2 to fall back to non-JIT matching when running on platforms without JIT support. ref https://github.com/BurntSushi/rust-pcre2/issues/3
2018-09-04ripgrep: add --pre-glob flagAndrew Gallant
The --pre-glob flag is like the --glob flag, except it applies to filtering files through the preprocessor instead of for search. This makes it possible to apply the preprocessor to only a small subset of files, which can greatly reduce the process overhead of using a preprocessor when searching large directories.
2018-09-04ripgrep: add --line-buffered and --block-bufferedAndrew Gallant
These flags provide granular control over ripgrep's buffering strategy. The --line-buffered flag can be genuinely useful in certain types of shell pipelines. The --block-buffered flag has a murkier use case, but we add it for completeness.
2018-09-04grep-cli: introduce new grep-cli crateAndrew Gallant
This commit moves a lot of "utility" code from ripgrep core into grep-cli. Any one of these things might not be worth creating a new crate, but combining everything together results in a fair number of a convenience routines that make up a decent sized crate. There is potentially more we could move into the crate, but much of what remains in ripgrep core is almost entirely dealing with the number of flags we support. In the course of doing moving things to the grep-cli crate, we clean up a lot of gunk and improve failure modes in a number of cases. In particular, we've fixed a bug where other processes could deadlock if they write too much to stderr. Fixes #990
2018-08-27doc: clarify and fix typoAndrew Gallant
Clarify that --byte-offset may be wrong if the source isn't being read directly. Also tweak the README a bit. And remove a damned Oxford comma.
2018-08-27ripgrep: use 'ignore' for skipping stdoutAndrew Gallant
This removes ripgrep-specific code for filtering files that correspond to stdout and instead uses the 'ignore' crate's functionality for doing the same.
2018-08-26ripgrep: add --sort and --sortr flagsAndrew Gallant
These flags each accept one of five choices: none, path, modified, accessed or created. The value indicates how the results are sorted. For --sort, results are sorted in ascending order where as for --sortr, results are sorted in descending order. Closes #404
2018-08-26ignore: add 'same_file_system' optionAndrew Gallant
This commit adds a 'same_file_system' option to the walk builder. For single threaded walking, it defers to the walkdir crate, which has the same option. The bulk of this commit implements this flag for the parallel walker. We add one very feeble test for this. The parallel walker is now officially a complete mess. Closes #321
2018-08-25ripgrep: use winapi-util for stdin_is_readableAndrew Gallant
2018-08-21doc: update ripgrep's descriptionAndrew Gallant
This now mentions PCRE2 support.
2018-08-21ripgrep: remove workaround for std bugAndrew Gallant
This commit undoes a work-around for a bug in Rust's standard library that prevented correct file type detection on Windows in OneDrive directories. We remove the work-around because we are moving to a latest-stable Rust version policy, which has included this fix for a while now. ref #705, https://github.com/rust-lang/rust/issues/46484
2018-08-21ripgrep: move minimum version to Rust stableAndrew Gallant
This also updates some code to make use of our more liberal versioning requirement, including the use of crossbeam-channel instead of the MsQueue from the older an unmaintained crossbeam 0.3. This does regrettably add a sizable number of dependencies, however, compile times seem mostly unaffected. Closes #1019
2018-08-21ripgrep: make --no-pcre2-unicode the canonical flagAndrew Gallant
Previously, we used --pcre2-unicode as the canonical flag despite the fact that it is enabled by default, which is inconsistent with how we handle other similar flags. The reason why --pcre2-unicode was made the canonical flag was to make it easier to discover since it would be sorted near the --pcre2 flag. To solve that problem, we simply start a convention that lists related flags in the docs. Fixes #1022
2018-08-20ripgrep: small cleanupsgrep-search-0.1.0grep-regex-0.1.0grep-printer-0.1.0grep-pcre2-0.1.0grep-matcher-0.1.0grep-0.2.0Andrew Gallant
2018-08-20ripgrep: add --no-multiline-dotalldana
2018-08-20ripgrep: fix typos in option descriptionsdana
2018-08-20ripgrep: migrate to libripgrepAndrew Gallant
This commit does the work to delete the old `grep` crate and effectively rewrite most of ripgrep core to use the new libripgrep crates. The new `grep` crate is now a facade that collects the various crates that make up libripgrep. The most complex part of ripgrep core is now arguably the translation between command line parameters and the library options, which is ultimately where we want to be.
2018-07-22ripgrep: when given no patterns, don't matchAndrew Gallant
Generally speaking, ripgrep prevents the case of not having any patterns via its arg parsing. However, it is possible for users to provide a file of patterns via the `-f` flag. If that file is empty, then ripgrep has nothing to search for and therefore should not ever produce any match. One way of fixing this might be to replace the absence of patterns with a pattern that can never match, but this still requires opening and searching through every file, which is quite a waste. Instead, we detect this case explicitly and quit early. Fixes #900
2018-07-22ripgrep: stop early when --files --quiet is usedAndrew Gallant
This commit tweaks the implementation of the --files flag to stop early when --quiet is provided. Fixes #907
2018-07-22ripgrep: don't skip tar archivesAndrew Gallant
This removes logic from the decompressor for skipping tar archives. This logic was originally added under the assumption that we probably want to avoid the cost of reading them. However, this is generally inconsistent with how ripgrep treats files like tar archives: it should search them and do binary detection like normal. Fixes #918
2018-07-22ripgrep: add --no-ignore-global flagAndrew Gallant
This commit adds a new --no-ignore-global flag that permits disabling the use of global gitignore filtering. Global gitignores are generally found in `$HOME/.config/git/ignore`, but its location can be configured via git's `core.excludesFile` option. Closes #934
2018-07-22ripgrep: improve usage documentationAndrew Gallant
This shows an example for reading stdin. Fixes #951
2018-07-22ripgrep: better --path-separator error messageAndrew Gallant
This commit improves the error message when --path-separator fails. Namely, it prints the separator it got and also prints a notice for Windows users for common failure modes. Fixes #957
2018-07-21ripgrep: add --no-pre switchAndrew Gallant
This switch explicitly disables the --pre behavior. An empty string will also disable --pre behavior, but actually utterring an empty flag value is quite awkward, so we provide an explicit switch to do the same thing. Thanks to @c-blake for pointing this out.
2018-07-21ripgrep: replace decoder with encoding_rs_ioAndrew Gallant
This commit mostly moves the transcoder implementation to its own crate: https://github.com/BurntSushi/encoding_rs_io The new crate adds clear documentation and cleans up the implementation to fully implement the contract of io::Read.
2018-07-21ripgrep: reformat --pre warningAndrew Gallant
2018-07-21ripgrep: add warning to --pre flagAndrew Gallant
The --pre flag can result in a pretty large performance penalty, so put a warning in the flag documentation. This warning is important because a flag like this could easily wind up in a user's configuration file.
2018-07-21ripgrep: add --pre flagCharles Blake
The preprocessor flag accepts a command program and executes this program for every input file that is searched. Instead of searching the file directly, ripgrep will instead search the stdout contents of the program. Closes #978, Closes #981
2018-07-21ripgrep: add support for lz4 decompressionKalle Samuels
This uses the lz4 binary for decompression. Closes #898
2018-06-25ripgrep: rename --maxdepth to --max-depthdana
We keep the old `--maxdepth` spelling to preserve backward compatibility. PR #967
2018-06-25ripgrep: add --fixed-strings flagdana
Fixes #964 PR #965
2018-06-23ripgrep/printer: fix small performance regressionAndrew Gallant
This commit removes an unconditional extra regex search that is in fact not always necessary. This can result in a 2x performance improvement in cases where ripgrep reports many matches. The fix itself isn't ideal, but we continue to punt on cleaning up the printer until it is rewritten for libripgrep, which is happening Real Soon Now. Fixes #955
2018-06-23ripgrep: use new BufferedStandardStream from termcolorAndrew Gallant
Specifically, this will use a buffered writer when not printing to a tty. This fixes a long standing performance regression where ripgrep would slow down dramatically if it needed to report a lot of matches. Fixes #955
2018-06-19ripgrep: use exit code 2 to indicate errorJon Surrell
Exit code 1 was shared to indicate both "no results" and "error." Use status code 2 to indicate errors, similar to grep's behavior. Fixes #948 PR #954
2018-04-23output: remove unnecessary mut bindingAndrew Gallant