mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-27 02:01:58 -07:00
Compare commits
27 Commits
grep-cli-0
...
globset-0.
Author | SHA1 | Date | |
---|---|---|---|
|
caba5c4348 | ||
|
07f97d42cf | ||
|
e33d6e73f5 | ||
|
478da4f271 | ||
|
7ce66f73cf | ||
|
bc76a30c23 | ||
|
5e81c60b35 | ||
|
b3e5ae9d28 | ||
|
a024f14fdd | ||
|
8c30c8294a | ||
|
c44d263419 | ||
|
af6b6c543b | ||
|
1a4fec8b4a | ||
|
c8d8ab8ded | ||
|
1d53ed2744 | ||
|
29696d1455 | ||
|
57ce623a57 | ||
|
f1c656de40 | ||
|
dd47582619 | ||
|
9b88cf8b72 | ||
|
6668d7ba8a | ||
|
008da5dca4 | ||
|
a34df1f690 | ||
|
7f3fd6f7ce | ||
|
6331a7ac18 | ||
|
cd4386bd9b | ||
|
cdc20c5685 |
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,9 +1,21 @@
|
||||
TBD
|
||||
===
|
||||
13.0.1
|
||||
======
|
||||
Unreleased changes. Release notes have not yet been written.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* [BUG #1891](https://github.com/BurntSushi/ripgrep/issues/1891):
|
||||
Fix bug when using `-w` with a regex that can match the empty string.
|
||||
|
||||
|
||||
13.0.0 (2021-06-12)
|
||||
===================
|
||||
ripgrep 13 is a new major version release of ripgrep that primarily contains
|
||||
bug fixes. There is also a fix for a security vulnerability on Windows
|
||||
([CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013)),
|
||||
some performance improvements and some minor breaking changes.
|
||||
bug fixes, some performance improvements and a few minor breaking changes.
|
||||
There is also a fix for a security vulnerability on Windows
|
||||
([CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013)).
|
||||
|
||||
Some highlights:
|
||||
|
||||
A new short flag, `-.`, has been added. It is an alias for the `--hidden` flag,
|
||||
which instructs ripgrep to search hidden files and directories.
|
||||
|
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -143,7 +143,7 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -158,7 +158,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"grep-cli",
|
||||
"grep-matcher",
|
||||
@@ -187,7 +187,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-matcher"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"regex",
|
||||
@@ -195,7 +195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"grep-matcher",
|
||||
"pcre2",
|
||||
@@ -203,7 +203,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-printer"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bstr",
|
||||
@@ -217,7 +217,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-regex"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -230,7 +230,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"bytecount",
|
||||
@@ -445,7 +445,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "ripgrep"
|
||||
version = "12.1.1"
|
||||
version = "13.0.0"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"clap",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ripgrep"
|
||||
version = "12.1.1" #:version
|
||||
version = "13.0.0" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
ripgrep is a line-oriented search tool that recursively searches the current
|
||||
@@ -42,7 +42,7 @@ members = [
|
||||
|
||||
[dependencies]
|
||||
bstr = "0.2.12"
|
||||
grep = { version = "0.2.7", path = "crates/grep" }
|
||||
grep = { version = "0.2.8", path = "crates/grep" }
|
||||
ignore = { version = "0.4.18", path = "crates/ignore" }
|
||||
lazy_static = "1.1.0"
|
||||
log = "0.4.5"
|
||||
|
10
GUIDE.md
10
GUIDE.md
@@ -178,11 +178,11 @@ search. By default, when you search a directory, ripgrep will ignore all of
|
||||
the following:
|
||||
|
||||
1. Files and directories that match glob patterns in these three categories:
|
||||
1. gitignore globs (including global and repo-specific globs).
|
||||
2. `.ignore` globs, which take precedence over all gitignore globs when
|
||||
there's a conflict.
|
||||
3. `.rgignore` globs, which take precedence over all `.ignore` globs when
|
||||
there's a conflict.
|
||||
1. gitignore globs (including global and repo-specific globs).
|
||||
2. `.ignore` globs, which take precedence over all gitignore globs
|
||||
when there's a conflict.
|
||||
3. `.rgignore` globs, which take precedence over all `.ignore` globs
|
||||
when there's a conflict.
|
||||
2. Hidden files and directories.
|
||||
3. Binary files. (ripgrep considers any file with a `NUL` byte to be binary.)
|
||||
4. Symbolic links aren't followed.
|
||||
|
@@ -26,6 +26,11 @@ Release Checklist
|
||||
`cargo update -p ripgrep` so that the `Cargo.lock` is updated. Commit the
|
||||
changes and create a new signed tag. Alternatively, use
|
||||
`cargo-up --no-push --no-release Cargo.toml {VERSION}` to automate this.
|
||||
* Push changes to GitHub, NOT including the tag. (But do not publish new
|
||||
version of ripgrep to crates.io yet.)
|
||||
* Once CI for `master` finishes successfully, push the version tag. (Trying to
|
||||
do this in one step seems to result in GitHub Actions not seeing the tag
|
||||
push and thus not running the release workflow.)
|
||||
* Wait for CI to finish creating the release. If the release build fails, then
|
||||
delete the tag from GitHub, make fixes, re-tag, delete the release and push.
|
||||
* Copy the relevant section of the CHANGELOG to the tagged release notes.
|
||||
|
@@ -39,4 +39,4 @@ cp complete/_rg "$DEPLOY_DIR/"
|
||||
|
||||
# Since we're distributing the dpkg, we don't know whether the user will have
|
||||
# PCRE2 installed, so just do a static build.
|
||||
PCRE2_SYS_STATIC=1 cargo deb
|
||||
PCRE2_SYS_STATIC=1 cargo deb --target x86_64-unknown-linux-musl
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "globset"
|
||||
version = "0.4.7" #:version
|
||||
version = "0.4.8" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Cross platform single glob and glob set matching. Glob set matching is the
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
use Glob;
|
||||
use crate::Glob;
|
||||
|
||||
impl Serialize for Glob {
|
||||
fn serialize<S: Serializer>(
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep"
|
||||
version = "0.2.7" #:version
|
||||
version = "0.2.8" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -14,12 +14,12 @@ license = "Unlicense/MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
grep-cli = { version = "0.1.5", path = "../cli" }
|
||||
grep-matcher = { version = "0.1.4", path = "../matcher" }
|
||||
grep-pcre2 = { version = "0.1.4", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.1.5", path = "../printer" }
|
||||
grep-regex = { version = "0.1.8", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.7", path = "../searcher" }
|
||||
grep-cli = { version = "0.1.6", path = "../cli" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
grep-pcre2 = { version = "0.1.5", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.1.6", path = "../printer" }
|
||||
grep-regex = { version = "0.1.9", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.8", path = "../searcher" }
|
||||
|
||||
[dev-dependencies]
|
||||
termcolor = "1.0.4"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-matcher"
|
||||
version = "0.1.4" #:version
|
||||
version = "0.1.5" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
A trait for regular expressions, with a focus on line oriented search.
|
||||
|
@@ -116,7 +116,7 @@ impl Match {
|
||||
/// This method panics if `start > self.end`.
|
||||
#[inline]
|
||||
pub fn with_start(&self, start: usize) -> Match {
|
||||
assert!(start <= self.end);
|
||||
assert!(start <= self.end, "{} is not <= {}", start, self.end);
|
||||
Match { start, ..*self }
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ impl Match {
|
||||
/// This method panics if `self.start > end`.
|
||||
#[inline]
|
||||
pub fn with_end(&self, end: usize) -> Match {
|
||||
assert!(self.start <= end);
|
||||
assert!(self.start <= end, "{} is not <= {}", self.start, end);
|
||||
Match { end, ..*self }
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.4" #:version
|
||||
version = "0.1.5" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use PCRE2 with the 'grep' crate.
|
||||
@@ -14,5 +14,5 @@ license = "Unlicense/MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
pcre2 = "0.2.0"
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
pcre2 = "0.2.3"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-printer"
|
||||
version = "0.1.5" #:version
|
||||
version = "0.1.6" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
An implementation of the grep crate's Sink trait that provides standard
|
||||
@@ -21,11 +21,11 @@ serde1 = ["base64", "serde", "serde_json"]
|
||||
[dependencies]
|
||||
base64 = { version = "0.13.0", optional = true }
|
||||
bstr = "0.2.0"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-searcher = { version = "0.1.4", path = "../searcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
grep-searcher = { version = "0.1.8", path = "../searcher" }
|
||||
termcolor = "1.0.4"
|
||||
serde = { version = "1.0.77", optional = true, features = ["derive"] }
|
||||
serde_json = { version = "1.0.27", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.3", path = "../regex" }
|
||||
grep-regex = { version = "0.1.9", path = "../regex" }
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-regex"
|
||||
version = "0.1.8" #:version
|
||||
version = "0.1.9" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use Rust's regex library with the 'grep' crate.
|
||||
@@ -16,7 +16,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
aho-corasick = "0.7.3"
|
||||
bstr = "0.2.10"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
log = "0.4.5"
|
||||
regex = "1.1"
|
||||
regex-syntax = "0.6.5"
|
||||
|
@@ -111,8 +111,15 @@ impl WordMatcher {
|
||||
}
|
||||
let (_, slen) = bstr::decode_utf8(&haystack[cand]);
|
||||
let (_, elen) = bstr::decode_last_utf8(&haystack[cand]);
|
||||
cand =
|
||||
cand.with_start(cand.start() + slen).with_end(cand.end() - elen);
|
||||
let new_start = cand.start() + slen;
|
||||
let new_end = cand.end() - elen;
|
||||
// This occurs the original regex can match the empty string. In this
|
||||
// case, just bail instead of trying to get it right here since it's
|
||||
// likely a pathological case.
|
||||
if new_start > new_end {
|
||||
return Err(());
|
||||
}
|
||||
cand = cand.with_start(new_start).with_end(new_end);
|
||||
if self.original.is_match(&haystack[cand]) {
|
||||
Ok(Some(cand))
|
||||
} else {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.7" #:version
|
||||
version = "0.1.8" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -18,12 +18,12 @@ bstr = { version = "0.2.0", default-features = false, features = ["std"] }
|
||||
bytecount = "0.6"
|
||||
encoding_rs = "0.8.14"
|
||||
encoding_rs_io = "0.1.6"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
log = "0.4.5"
|
||||
memmap = { package = "memmap2", version = "0.3.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.3", path = "../regex" }
|
||||
grep-regex = { version = "0.1.9", path = "../regex" }
|
||||
regex = "1.1"
|
||||
|
||||
[features]
|
||||
|
@@ -1,14 +1,14 @@
|
||||
class RipgrepBin < Formula
|
||||
version '12.1.1'
|
||||
version '13.0.0'
|
||||
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 "7ff2fd5dd3a438d62fae5866ddae78cf542b733116f58cf21ab691a58c385703"
|
||||
sha256 "585c18350cb8d4392461edd6c921e6edd5a97cbfc03b567d7bd440423e118082"
|
||||
elsif OS.linux?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
|
||||
sha256 "88d3b735e43f6f16a0181a8fec48847693fae80168d5f889fdbdeb962f1fc804"
|
||||
sha256 "ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091"
|
||||
end
|
||||
|
||||
conflicts_with "ripgrep"
|
||||
|
@@ -1029,3 +1029,18 @@ rgtest!(r1878, |dir: Dir, _: TestCommand| {
|
||||
let args = &["-U", "--mmap", r"\Abaz", "test"];
|
||||
dir.command().args(args).assert_err();
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/1891
|
||||
rgtest!(r1891, |dir: Dir, mut cmd: TestCommand| {
|
||||
// TODO: Sadly, PCRE2 has different behavior here. Not clear why. We should
|
||||
// look into this and see if there's a fix needed at the regex engine
|
||||
// level.
|
||||
if dir.is_pcre2() {
|
||||
return;
|
||||
}
|
||||
|
||||
dir.create("test", "\n##\n");
|
||||
// N.B. We use -o here to force the issue to occur, which seems to only
|
||||
// happen when each match needs to be detected.
|
||||
eqnice!("1:\n2:\n2:\n", cmd.args(&["-won", "", "test"]).stdout());
|
||||
});
|
||||
|
Reference in New Issue
Block a user