Compare commits

...

26 Commits

Author SHA1 Message Date
Andrew Gallant
0096c74c11 grep-0.3.1 2023-11-27 21:36:54 -05:00
Andrew Gallant
8c48355b03 deps: bump grep-printer to 0.2.1 2023-11-27 21:36:44 -05:00
Andrew Gallant
f9b86de963 grep-printer-0.2.1 2023-11-27 21:36:02 -05:00
Andrew Gallant
d23b74975a deps: bump grep-searcher to 0.1.13 2023-11-27 21:35:53 -05:00
Andrew Gallant
a5cbdb3dfe grep-searcher-0.1.13 2023-11-27 21:34:58 -05:00
Andrew Gallant
b6bac8484e cargo: add release-lto profile
The idea is to build ripgrep with as much optimization as possible.

This makes compilation times absolutely obscene. They jump from <10
seconds to 30+ seconds on my i9-12900K. I don't even want to know how
long CI would take with these.

I tried some ad hoc benchmarks and could not notice any meaningful
improvement with the LTO binary versus the normal release profile.
Because of that, I still don't think it's worth bloating the release
cycle times.

Ref #1225
2023-11-27 21:31:03 -05:00
Andrew Gallant
805fa32d18 searcher: work around NUL line terminator bug
As the FIXME comment says, ripgrep is not yet using the new line
terminator option in regex-automata exposed for exactly this purpose.
Because of that, line anchors like `(?m:^)` and `(?m:$)` will only match
`\n` as a line terminator. This means that when --null-data is used in
combination with --line-regexp, the anchors inserted by --line-regexp
will not match correctly. This is only a big deal in the "fast" path,
which requires the regex engine to deal with line terminators itself
correctly. The slow path strips line terminators regardless of what they
are, and so the line anchors can match (begin/end of haystack).

Fixes #2658
2023-11-27 21:17:12 -05:00
Andrew Gallant
2d518dd1f9 release: tweak how sha256sum is invoked
The output would ideally just have the basename of the file and not a
meaningless relative path.

Fixes #2654
2023-11-27 21:17:12 -05:00
Jan Verbeek
8575d26179 complete/fish: Fix syntax for negated options
And also, negated options don't take arguments.

Specifically, the fish completion generator currently forgets to add
`-l` to negation options, leading to a list of these errors:

    complete: too many arguments

    ~/.config/fish/completions/rg.fish (line 146):
    complete -c rg -n '__fish_use_subcommand'  no-sort-files -d '(DEPRECATED) Sort results by file path.'
    ^
    from sourcing file ~/.config/fish/completions/rg.fish

    (Type 'help complete' for related documentation)

To reproduce, run `fish -c 'rg --generate=complete-fish | source'`.

It also potentially suggests a list of choices for negation options,
even though those never take arguments. That case doesn't occur with
any of the current options but it's an easy fix.

Fixes #2659, Closes #2655
2023-11-27 21:17:12 -05:00
Jon Jensen
2e81a7adfe doc: fix typo that was preventing interpolation
Closes #2662
2023-11-27 21:17:12 -05:00
Andrew Gallant
cd5440fb62 changelog: fix wording
Ref: https://news.ycombinator.com/item?id=38425790
2023-11-26 17:58:30 -05:00
Andrew Gallant
2ee690e87a pkg/brew: update tap 2023-11-26 17:37:52 -05:00
Andrew Gallant
59f86a45d3 14.0.1 2023-11-26 16:33:35 -05:00
Andrew Gallant
2d31af38a2 cargo: include pkg/windows in crate package
Fixes #2653
2023-11-26 16:32:59 -05:00
Andrew Gallant
0da1176e7d pkg/brew: update tap 2023-11-26 15:27:09 -05:00
Andrew Gallant
eeffcd50b7 doc: add step to run 'cargo package' 2023-11-26 15:25:23 -05:00
Andrew Gallant
625743d7c8 grep-0.3.0 2023-11-26 15:24:09 -05:00
Andrew Gallant
3d0171040a grep-printer-0.2.0 2023-11-26 15:21:40 -05:00
Andrew Gallant
93429d0f85 14.0.0 2023-11-26 14:19:31 -05:00
Andrew Gallant
9c4b0baf10 deps: bump grep to 0.2.13 2023-11-26 14:18:53 -05:00
Andrew Gallant
179487aaed grep-0.2.13 2023-11-26 14:18:17 -05:00
Andrew Gallant
b407d62b63 deps: bump grep-searcher to 0.1.12 2023-11-26 14:18:03 -05:00
Andrew Gallant
9bd1e737bc grep-searcher-0.1.12 2023-11-26 14:17:26 -05:00
Andrew Gallant
c12231c621 deps: bump grep-pcre2 to 0.1.7 2023-11-26 14:17:11 -05:00
Andrew Gallant
b0df573834 grep-pcre2-0.1.7 2023-11-26 14:16:46 -05:00
Andrew Gallant
85b2ceecd1 deps: bump grep-regex to 0.1.12 2023-11-26 14:16:31 -05:00
14 changed files with 95 additions and 35 deletions

View File

@@ -332,14 +332,15 @@ jobs:
run: |
cargo deb --profile deb --target ${{ env.TARGET }}
version="${{ needs.create-release.outputs.version }}"
deb="target/${{ env.TARGET }}/debian/ripgrep_$version-1_amd64.deb"
echo "DEB=$deb" >> $GITHUB_ENV
echo "DEB_DIR=target/${{ env.TARGET }}/debian" >> $GITHUB_ENV
echo "DEB_NAME=ripgrep_$version-1_amd64.deb" >> $GITHUB_ENV
- name: Create sha256 sum of deb file
shell: bash
run: |
sum="$DEB.sha256"
shasum -a 256 "$DEB" > "$sum"
cd "$DEB_DIR"
sum="$DEB_NAME.sha256"
shasum -a 256 "$DEB_NAME" > "$sum"
echo "SUM=$sum" >> $GITHUB_ENV
- name: Upload release archive
@@ -347,5 +348,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
cd "$DEB_DIR"
version="${{ needs.create-release.outputs.version }}"
gh release upload "$version" ${{ env.DEB }} ${{ env.SUM }}
gh release upload "$version" "$DEB_NAME" "$SUM"

View File

@@ -1,9 +1,35 @@
14.0.2 (2023-11-27)
===================
This is a patch release with a few small bug fixes.
Bug fixes:
* [BUG #2654](https://github.com/BurntSushi/ripgrep/issues/2654):
Fix `deb` release sha256 sum file.
* [BUG #2658](https://github.com/BurntSushi/ripgrep/issues/2658):
Fix partial regression in the behavior of `--null-data --line-regexp`.
* [BUG #2659](https://github.com/BurntSushi/ripgrep/issues/2659):
Fix Fish shell completions.
* [BUG #2662](https://github.com/BurntSushi/ripgrep/issues/2662):
Fix typo in documentation for `-i/--ignore-case`.
14.0.1 (2023-11-26)
===================
This a patch release meant to fix `cargo install ripgrep` on Windows.
Bug fixes:
* [BUG #2653](https://github.com/BurntSushi/ripgrep/issues/2653):
Include `pkg/windows/Manifest.xml` in crate package.
14.0.0 (2023-11-26)
===================
ripgrep 14 is a new major version release of ripgrep that has some new
features, performance improvements and a lot of bug fixes.
The headling feature in this release is hyperlink support. In this release,
The headlining feature in this release is hyperlink support. In this release,
they are an opt-in feature but may change to an opt-out feature in the future.
To enable them, try passing `--hyperlink-format default`. If you use [VS Code],
then try passing `--hyperlink-format vscode`. Please [report your experience
@@ -12,10 +38,10 @@ with hyperlinks][report-hyperlinks], positive or negative.
[VS Code]: https://code.visualstudio.com/
[report-hyperlinks]: https://github.com/BurntSushi/ripgrep/discussions/2611
Another headling development in this release is that it contains a rewrite of
its regex engine. You generally shouldn't notice any changes, except for some
searches may get faster. You can read more about the [regex engine rewrite on
my blog][regex-internals]. Please [report your performance improvements or
Another headlining development in this release is that it contains a rewrite
of its regex engine. You generally shouldn't notice any changes, except for
some searches may get faster. You can read more about the [regex engine rewrite
on my blog][regex-internals]. Please [report your performance improvements or
regressions that you notice][report-perf].
[report-perf]: https://github.com/BurntSushi/ripgrep/discussions/2652

10
Cargo.lock generated
View File

@@ -134,7 +134,7 @@ dependencies = [
[[package]]
name = "grep"
version = "0.2.12"
version = "0.3.1"
dependencies = [
"grep-cli",
"grep-matcher",
@@ -168,7 +168,7 @@ dependencies = [
[[package]]
name = "grep-pcre2"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"grep-matcher",
"log",
@@ -177,7 +177,7 @@ dependencies = [
[[package]]
name = "grep-printer"
version = "0.1.7"
version = "0.2.1"
dependencies = [
"bstr",
"grep-matcher",
@@ -202,7 +202,7 @@ dependencies = [
[[package]]
name = "grep-searcher"
version = "0.1.11"
version = "0.1.13"
dependencies = [
"bstr",
"encoding_rs",
@@ -411,7 +411,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "ripgrep"
version = "13.0.0"
version = "14.0.1"
dependencies = [
"anyhow",
"bstr",

View File

@@ -1,6 +1,6 @@
[package]
name = "ripgrep"
version = "13.0.0" #:version
version = "14.0.1" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
ripgrep is a line-oriented search tool that recursively searches the current
@@ -17,7 +17,7 @@ exclude = [
"HomebrewFormula",
"/.github/",
"/ci/",
"/pkg/",
"/pkg/brew",
"/benchsuite/",
"/scripts/",
]
@@ -51,7 +51,7 @@ members = [
[dependencies]
anyhow = "1.0.75"
bstr = "1.7.0"
grep = { version = "0.2.12", path = "crates/grep" }
grep = { version = "0.3.0", path = "crates/grep" }
ignore = { version = "0.4.21", path = "crates/ignore" }
lexopt = "0.3.0"
log = "0.4.5"
@@ -74,6 +74,18 @@ pcre2 = ["grep/pcre2"]
[profile.release]
debug = 1
[profile.release-lto]
inherits = "release"
opt-level = 3
debug = "none"
strip = "symbols"
debug-assertions = false
overflow-checks = false
lto = "fat"
panic = "abort"
incremental = false
codegen-units = 1
# This is the main way to strip binaries in the deb package created by
# 'cargo deb'. For other release binaries, we (currently) call 'strip'
# explicitly in the release process.

View File

@@ -27,6 +27,7 @@
`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.
* Run `cargo package` and ensure it succeeds.
* Push changes to GitHub, NOT including the tag. (But do not publish a new
version of ripgrep to crates.io yet.)
* Once CI for `master` finishes successfully, push the version tag. (Trying to

View File

@@ -35,10 +35,11 @@ pub(crate) fn generate() -> String {
.replace("!DOC!", &doc),
);
if let Some(negated) = flag.name_negated() {
let long = format!("-l '{}'", negated.replace("'", "\\'"));
out.push_str(
&template
&TEMPLATE
.replace("!SHORT!", "")
.replace("!LONG!", &negated)
.replace("!LONG!", &long)
.replace("!DOC!", &doc),
);
}

View File

@@ -3078,7 +3078,7 @@ Individual patterns can still be matched case sensitively by using
inline regex flags. For example, \fB(?\-i)abc\fP will match \fBabc\fP
case sensitively even when this flag is used.
.sp
This flag overrides \flag{case-sensitive} and flag{smart-case}.
This flag overrides \flag{case-sensitive} and \flag{smart-case}.
"#
}

View File

@@ -1,6 +1,6 @@
[package]
name = "grep"
version = "0.2.12" #:version
version = "0.3.1" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
Fast line oriented regex searching as a library.
@@ -16,10 +16,10 @@ edition = "2021"
[dependencies]
grep-cli = { version = "0.1.10", path = "../cli" }
grep-matcher = { version = "0.1.7", path = "../matcher" }
grep-pcre2 = { version = "0.1.6", path = "../pcre2", optional = true }
grep-printer = { version = "0.1.7", path = "../printer" }
grep-regex = { version = "0.1.11", path = "../regex" }
grep-searcher = { version = "0.1.11", path = "../searcher" }
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" }
[dev-dependencies]
termcolor = "1.0.4"

View File

@@ -1,6 +1,6 @@
[package]
name = "grep-pcre2"
version = "0.1.6" #:version
version = "0.1.7" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
Use PCRE2 with the 'grep' crate.

View File

@@ -1,6 +1,6 @@
[package]
name = "grep-printer"
version = "0.1.7" #:version
version = "0.2.1" #: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.11", path = "../searcher" }
grep-searcher = { version = "0.1.13", 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.11", path = "../regex" }
grep-regex = { version = "0.1.12", path = "../regex" }
[package.metadata.docs.rs]
# We want to document all features.

View File

@@ -1,6 +1,6 @@
[package]
name = "grep-searcher"
version = "0.1.11" #:version
version = "0.1.13" #: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.11", path = "../regex" }
grep-regex = { version = "0.1.12", path = "../regex" }
regex = "1.9.5"
[features]

View File

@@ -612,6 +612,17 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
return false;
}
if let Some(line_term) = self.matcher.line_terminator() {
// FIXME: This works around a bug in grep-regex where it does
// not set the line terminator of the regex itself, and thus
// line anchors like `(?m:^)` and `(?m:$)` will not match
// anything except for `\n`. So for now, we just disable the fast
// line-by-line searcher which requires the regex to be able to
// deal with line terminators correctly. The slow line-by-line
// searcher strips line terminators and thus absolves the regex
// engine from needing to care about whether they are `\n` or NUL.
if line_term.as_byte() == b'\x00' {
return false;
}
if line_term == self.config.line_term {
return true;
}

View File

@@ -1,14 +1,14 @@
class RipgrepBin < Formula
version '13.0.0'
version '14.0.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 "585c18350cb8d4392461edd6c921e6edd5a97cbfc03b567d7bd440423e118082"
sha256 "927f3f02929ded0bae21e8a93283b5466c8807b38cea94a96bbec0acc6a22786"
elsif OS.linux?
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
sha256 "ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091"
sha256 "e0ca32aabfc3426c00201301fd258c7da2b18431af4edac715c56da5e4326538"
end
conflicts_with "ripgrep"

View File

@@ -1210,3 +1210,10 @@ rgtest!(r2574, |dir: Dir, mut cmd: TestCommand| {
.stdout();
eqnice!("some.domain.com\nsome.domain.com\n", got);
});
// See: https://github.com/BurntSushi/ripgrep/issues/2658
rgtest!(r2658_null_data_line_regexp, |dir: Dir, mut cmd: TestCommand| {
dir.create("haystack", "foo\0bar\0quux\0");
let got = cmd.args(&["--null-data", "--line-regexp", r"bar"]).stdout();
eqnice!("haystack:bar\0", got);
});