Compare commits
22 Commits
grep-cli-0
...
globset-0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de4baa1002 | ||
|
|
163ac157d3 | ||
|
|
e2362d4d51 | ||
|
|
d6b59feff8 | ||
|
|
94305125ef | ||
|
|
79cbe89deb | ||
|
|
bf63fe8f25 | ||
|
|
8bd5950296 | ||
|
|
6e0539ab91 | ||
|
|
4649aa9700 | ||
|
|
c009652e77 | ||
|
|
b9f7a9ba2b | ||
|
|
a1960877cf | ||
|
|
bb0925af91 | ||
|
|
be117dbafa | ||
|
|
06dc13ad2d | ||
|
|
c6c2e69b8f | ||
|
|
e67c868ddd | ||
|
|
d33f2e2f70 | ||
|
|
082edafffa | ||
|
|
7c8dc332b3 | ||
|
|
ea961915b5 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -189,7 +189,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ${{ env.CARGO }} test --bin rg ${{ env.TARGET_FLAGS }} flags::defs::tests::available_shorts -- --nocapture
|
||||
|
||||
# Setup and compile on the wasm32-wasi target
|
||||
# Setup and compile on the wasm32-wasip1 target
|
||||
wasm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -199,8 +199,8 @@ jobs:
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Add wasm32-wasi target
|
||||
run: rustup target add wasm32-wasi
|
||||
- name: Add wasm32-wasip1 target
|
||||
run: rustup target add wasm32-wasip1
|
||||
- name: Basic build
|
||||
run: cargo build --verbose
|
||||
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,6 +1,18 @@
|
||||
TBD
|
||||
===
|
||||
Unreleased changes. Release notes have not yet been written.
|
||||
|
||||
|
||||
14.1.1 (2024-09-08)
|
||||
===================
|
||||
Unreleased changes. Release notes have not yet been written.
|
||||
This is a minor release with a bug fix for a matching bug. In particular, a bug
|
||||
was found that could cause ripgrep to ignore lines that should match. That is,
|
||||
false negatives. It is difficult to characterize the specific set of regexes
|
||||
in which this occurs as it requires multiple different optimization strategies
|
||||
to collide and produce an incorrect result. But as one reported example, in
|
||||
ripgrep, the regex `(?i:e.x|ex)` does not match `e-x` when it should. (This
|
||||
bug is a result of an inner literal optimization performed in the `grep-regex`
|
||||
crate and not in the `regex` crate.)
|
||||
|
||||
Bug fixes:
|
||||
|
||||
|
||||
14
Cargo.lock
generated
14
Cargo.lock
generated
@@ -105,7 +105,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.15"
|
||||
version = "0.4.16"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -119,7 +119,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"grep-cli",
|
||||
"grep-matcher",
|
||||
@@ -153,7 +153,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
dependencies = [
|
||||
"grep-matcher",
|
||||
"log",
|
||||
@@ -162,7 +162,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-printer"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"grep-matcher",
|
||||
@@ -176,7 +176,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-regex"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"grep-matcher",
|
||||
@@ -187,7 +187,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.13"
|
||||
version = "0.1.14"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"encoding_rs",
|
||||
@@ -361,7 +361,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "ripgrep"
|
||||
version = "14.1.0"
|
||||
version = "14.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bstr",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ripgrep"
|
||||
version = "14.1.0" #:version
|
||||
version = "14.1.1" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
ripgrep is a line-oriented search tool that recursively searches the current
|
||||
@@ -51,7 +51,7 @@ members = [
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
bstr = "1.7.0"
|
||||
grep = { version = "0.3.1", path = "crates/grep" }
|
||||
grep = { version = "0.3.2", path = "crates/grep" }
|
||||
ignore = { version = "0.4.23", path = "crates/ignore" }
|
||||
lexopt = "0.3.0"
|
||||
log = "0.4.5"
|
||||
|
||||
23
FAQ.md
23
FAQ.md
@@ -94,7 +94,7 @@ Does ripgrep have support for shell auto-completion?
|
||||
|
||||
Yes! If you installed ripgrep through a package manager on a Unix system, then
|
||||
the shell completion files included in the release archive should have been
|
||||
installed for you automatically. If not, you can generate completes using
|
||||
installed for you automatically. If not, you can generate completions using
|
||||
ripgrep's command line interface.
|
||||
|
||||
For **bash**:
|
||||
@@ -113,14 +113,31 @@ $ mkdir -p "$dir"
|
||||
$ rg --generate complete-fish > "$dir/rg.fish"
|
||||
```
|
||||
|
||||
For **zsh**:
|
||||
For **zsh**, the recommended approach is:
|
||||
|
||||
```
|
||||
```zsh
|
||||
$ dir="$HOME/.zsh-complete"
|
||||
$ mkdir -p "$dir"
|
||||
$ rg --generate complete-zsh > "$dir/_rg"
|
||||
```
|
||||
|
||||
And then add `$HOME/.zsh-complete` to your `fpath` in, e.g., your
|
||||
`$HOME/.zshrc` file:
|
||||
|
||||
```zsh
|
||||
fpath=($HOME/.zsh-complete $fpath)
|
||||
```
|
||||
|
||||
Or if you'd prefer to load and generate completions at the same time, you can
|
||||
add the following to your `$HOME/.zshrc` file:
|
||||
|
||||
```zsh
|
||||
$ source <(rg --generate complete-zsh)
|
||||
```
|
||||
|
||||
Note though that while this approach is easier to setup, is generally slower
|
||||
than the previous method, and will add more time to loading your shell prompt.
|
||||
|
||||
For **PowerShell**, create the completions:
|
||||
|
||||
```
|
||||
|
||||
@@ -434,7 +434,15 @@ _rg_types() {
|
||||
fi
|
||||
}
|
||||
|
||||
_rg "$@"
|
||||
# Don't run the completion function when being sourced by itself.
|
||||
#
|
||||
# See https://github.com/BurntSushi/ripgrep/issues/2956
|
||||
# See https://github.com/BurntSushi/ripgrep/pull/2957
|
||||
if [[ $funcstack[1] == _rg ]] || (( ! $+functions[compdef] )); then
|
||||
_rg "$@"
|
||||
else
|
||||
compdef _rg rg
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# ZSH COMPLETION REFERENCE
|
||||
|
||||
@@ -43,10 +43,10 @@ configuration file. The file can specify one shell argument per line. Lines
|
||||
starting with \fB#\fP are ignored. For more details, see \fBCONFIGURATION
|
||||
FILES\fP below.
|
||||
.sp
|
||||
ripgrep will automatically detect if stdin exists and search stdin for a regex
|
||||
pattern, e.g. \fBls | rg foo\fP. In some environments, stdin may exist when
|
||||
it shouldn't. To turn off stdin detection, one can explicitly specify the
|
||||
directory to search, e.g. \fBrg foo ./\fP.
|
||||
ripgrep will automatically detect if stdin is a readable file and search stdin
|
||||
for a regex pattern, e.g. \fBls | rg foo\fP. In some environments, stdin may
|
||||
exist when it shouldn't. To turn off stdin detection, one can explicitly
|
||||
specify the directory to search, e.g. \fBrg foo ./\fP.
|
||||
.sp
|
||||
Like other tools such as \fBls\fP, ripgrep will alter its output depending on
|
||||
whether stdout is connected to a tty. By default, when printing a tty, ripgrep
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "globset"
|
||||
version = "0.4.15" #:version
|
||||
version = "0.4.16" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Cross platform single glob and glob set matching. Glob set matching is the
|
||||
|
||||
@@ -928,13 +928,26 @@ impl RequiredExtensionStrategyBuilder {
|
||||
///
|
||||
/// The escaping works by surrounding meta-characters with brackets. For
|
||||
/// example, `*` becomes `[*]`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use globset::escape;
|
||||
///
|
||||
/// assert_eq!(escape("foo*bar"), "foo[*]bar");
|
||||
/// assert_eq!(escape("foo?bar"), "foo[?]bar");
|
||||
/// assert_eq!(escape("foo[bar"), "foo[[]bar");
|
||||
/// assert_eq!(escape("foo]bar"), "foo[]]bar");
|
||||
/// assert_eq!(escape("foo{bar"), "foo[{]bar");
|
||||
/// assert_eq!(escape("foo}bar"), "foo[}]bar");
|
||||
/// ```
|
||||
pub fn escape(s: &str) -> String {
|
||||
let mut escaped = String::with_capacity(s.len());
|
||||
for c in s.chars() {
|
||||
match c {
|
||||
// note that ! does not need escaping because it is only special
|
||||
// inside brackets
|
||||
'?' | '*' | '[' | ']' => {
|
||||
'?' | '*' | '[' | ']' | '{' | '}' => {
|
||||
escaped.push('[');
|
||||
escaped.push(c);
|
||||
escaped.push(']');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep"
|
||||
version = "0.3.1" #:version
|
||||
version = "0.3.2" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -14,12 +14,12 @@ license = "Unlicense OR MIT"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
grep-cli = { version = "0.1.10", path = "../cli" }
|
||||
grep-cli = { version = "0.1.11", path = "../cli" }
|
||||
grep-matcher = { version = "0.1.7", path = "../matcher" }
|
||||
grep-pcre2 = { version = "0.1.7", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.2.1", path = "../printer" }
|
||||
grep-regex = { version = "0.1.12", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.13", path = "../searcher" }
|
||||
grep-pcre2 = { version = "0.1.8", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.2.2", path = "../printer" }
|
||||
grep-regex = { version = "0.1.13", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.14", path = "../searcher" }
|
||||
|
||||
[dev-dependencies]
|
||||
termcolor = "1.0.4"
|
||||
|
||||
@@ -389,6 +389,15 @@ pub trait Captures {
|
||||
/// for the overall match.
|
||||
fn get(&self, i: usize) -> Option<Match>;
|
||||
|
||||
/// Return the overall match for the capture.
|
||||
///
|
||||
/// This returns the match for index `0`. That is it is equivalent to
|
||||
/// `get(0).unwrap()`
|
||||
#[inline]
|
||||
fn as_match(&self) -> Match {
|
||||
self.get(0).unwrap()
|
||||
}
|
||||
|
||||
/// Returns true if and only if these captures are empty. This occurs
|
||||
/// when `len` is `0`.
|
||||
///
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.7" #:version
|
||||
version = "0.1.8" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use PCRE2 with the 'grep' crate.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-printer"
|
||||
version = "0.2.1" #:version
|
||||
version = "0.2.2" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
An implementation of the grep crate's Sink trait that provides standard
|
||||
@@ -21,14 +21,14 @@ serde = ["dep:serde", "dep:serde_json"]
|
||||
[dependencies]
|
||||
bstr = "1.6.2"
|
||||
grep-matcher = { version = "0.1.7", path = "../matcher" }
|
||||
grep-searcher = { version = "0.1.13", path = "../searcher" }
|
||||
grep-searcher = { version = "0.1.14", path = "../searcher" }
|
||||
log = "0.4.5"
|
||||
termcolor = "1.3.0"
|
||||
serde = { version = "1.0.193", optional = true }
|
||||
serde_json = { version = "1.0.107", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.12", path = "../regex" }
|
||||
grep-regex = { version = "0.1.13", path = "../regex" }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
# We want to document all features.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-regex"
|
||||
version = "0.1.12" #:version
|
||||
version = "0.1.13" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use Rust's regex library with the 'grep' crate.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.13" #:version
|
||||
version = "0.1.14" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -23,7 +23,7 @@ memchr = "2.6.3"
|
||||
memmap = { package = "memmap2", version = "0.9.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.12", path = "../regex" }
|
||||
grep-regex = { version = "0.1.13", path = "../regex" }
|
||||
regex = "1.9.5"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -1004,6 +1004,7 @@ fn slice_has_bom(slice: &[u8]) -> bool {
|
||||
None => return false,
|
||||
Some((enc, _)) => enc,
|
||||
};
|
||||
log::trace!("found byte-order mark (BOM) for encoding {enc:?}");
|
||||
[encoding_rs::UTF_16LE, encoding_rs::UTF_16BE, encoding_rs::UTF_8]
|
||||
.contains(&enc)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
class RipgrepBin < Formula
|
||||
version '14.1.0'
|
||||
version '14.1.1'
|
||||
desc "Recursively search directories for a regex pattern."
|
||||
homepage "https://github.com/BurntSushi/ripgrep"
|
||||
|
||||
if OS.mac?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
sha256 "fc87e78f7cb3fea12d69072e7ef3b21509754717b746368fd40d88963630e2b3"
|
||||
elsif OS.linux?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
sha256 "4cf9f2741e6c465ffdb7c26f38056a59e2a2544b51f7cc128ef28337eeae4d8e"
|
||||
end
|
||||
|
||||
conflicts_with "ripgrep"
|
||||
|
||||
Reference in New Issue
Block a user