1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-02 02:56:32 +02:00
Commit Graph

2049 Commits

Author SHA1 Message Date
Andrew Gallant
79cbe89deb
doc: tweak wording for stdin detection
This makes it slightly more precise to cover weird cases like trying to
pass a directory on stdin.

Closes #2906
2024-09-30 07:38:05 -04:00
Thayne McCombs
bf63fe8f25
regex: add as_match method to Captures trait
Ref https://github.com/rust-lang/regex/issues/1146

PR #2898
2024-09-19 09:30:31 -04:00
Andrew Gallant
8bd5950296
changelog: add next section 2024-09-08 22:32:09 -04:00
Andrew Gallant
6e0539ab91
pkg/brew: update tap 2024-09-08 22:32:02 -04:00
Andrew Gallant
4649aa9700
14.1.1 2024-09-08 22:15:00 -04:00
Andrew Gallant
c009652e77
changelog: 14.1.1 2024-09-08 22:13:53 -04:00
Andrew Gallant
b9f7a9ba2b
deps: bump grep to 0.3.2 2024-09-08 22:11:17 -04:00
Andrew Gallant
a1960877cf
grep-0.3.2 2024-09-08 22:11:00 -04:00
Andrew Gallant
bb0925af91
deps: bump grep-printer to 0.2.2 2024-09-08 22:10:49 -04:00
Andrew Gallant
be117dbafa
grep-printer-0.2.2 2024-09-08 22:10:29 -04:00
Andrew Gallant
06dc13ad2d
deps: bump grep-searcher to 0.1.14 2024-09-08 22:09:55 -04:00
Andrew Gallant
c6c2e69b8f
grep-searcher-0.1.14 2024-09-08 22:09:27 -04:00
Andrew Gallant
e67c868ddd
deps: bump grep-pcre2 to 0.1.8 2024-09-08 22:09:23 -04:00
Andrew Gallant
d33f2e2f70
grep-pcre2-0.1.8 2024-09-08 22:08:41 -04:00
Andrew Gallant
082edafffa
deps: bump grep-regex to 0.1.13 2024-09-08 22:08:22 -04:00
Andrew Gallant
7c8dc332b3
grep-regex-0.1.13 2024-09-08 22:07:52 -04:00
Andrew Gallant
ea961915b5
deps: bump grep-cli to 0.1.11 2024-09-08 22:07:30 -04:00
Andrew Gallant
7943bdfe82
grep-cli-0.1.11 2024-09-08 22:06:59 -04:00
Andrew Gallant
312a7884fc
deps: bump ignore to 0.4.23 2024-09-08 22:06:39 -04:00
Andrew Gallant
ac02f54c89
ignore-0.4.23 2024-09-08 22:06:03 -04:00
Andrew Gallant
24b337b940
deps: bump globset to 0.4.15 2024-09-08 22:05:45 -04:00
Andrew Gallant
a5083f99ce
globset-0.4.15 2024-09-08 22:04:48 -04:00
Andrew Gallant
f89cdba5df
doc: update date in man page template 2024-09-08 22:04:11 -04:00
Andrew Gallant
f7b677d136
deps: update everything 2024-09-08 22:03:29 -04:00
Andrew Gallant
3f68a8f3d7
changelog: 14.1.1 2024-09-08 22:03:22 -04:00
Andrew Gallant
9d738ad0c0 regex: fix inner literal extraction that resulted in false negatives
In some rare cases, it was possible for ripgrep's inner literal detector
to extract a set of literals that could produce a false negative. #2884
gives an example: `(?i:e.x|ex)`. In this case, the set extracted can be
discovered by running `rg '(?i:e.x|ex) --trace`:

    Seq[E("EX"), E("Ex"), E("eX"), E("ex")]

This extraction leads to building a multi-substring matcher for `EX`,
`Ex`, `eX` and `ex`. Searching the haystack `e-x` produces no match,
and thus, ripgrep shows no matches. But the regex `(?i:e.x|ex)` matches
`e-x`.

The issue at play here was that when two extracted literal sequences
were unioned, we were correctly unioning their "prefix" attribute.
And this in turn leads to those literal sequences being combined
incorrectly via cross product. This case in particular triggers it
because two different optimizations combine to produce an incorrect
result. Firslty, the regex has a common prefix extracted and is
rewritten as `(?i:e(?:.x|x))`. Secondly, the `x` in the first branch of
the alternation has its `prefix` attribute set to `false` (correctly),
which means it can't be cross producted with another concatenation. But
in this case, it is unioned with the `x` from the second branch, and
this results in the union result having `prefix` set to `true`. This
in turn pops up and lets it get cross producted with the `e` prefix,
producing an incorrect literal sequence.

We fix this by changing the implementation of `union` to return
`prefix` set to `true` only when *both* literal sequences being unioned
have `prefix` set to `true`.

Doing this exposed a second bug that was present, but was purely
cosmetic: the extracted literals in this case, after the fix, are
`X` and `x`. They were considered "exact" (i.e., lead to a match),
but of course they are not. Observing an `X` or an `x` does not mean
there is a match. This was fixed by making `choose` always return
an inexact literal sequence. This is perhaps too conservative in
aggregate in some cases, but always correct. The idea here is that if
one is choosing between two concatenations, then it is likely the case
that the sequence returned should be considered inexact. The issue
is that this can lead to avoiding cross products in some cases that
would otherwise be correct. This is bad because it means extracting
shorter literals in some cases. (In general, the longer the literal the
better.) But we prioritize correctness for now and fix it. You can see
a few tests where this shortens some extracted literals.

Fixes #2884
2024-09-08 22:00:46 -04:00
Andrew Gallant
6c5108ed17
github: add FUNDING 2024-09-03 11:46:01 -04:00
Andrew Gallant
e0f1000df6
deps: update everything
This removes `once_cell` (a dependency of `cc`) but adds `shlex` (also a
dependency of `cc`). AFAIK, ripgrep does not utilize anything in `cc`
that requires `shlex`, which is pretty unfortunate that we have to spend
time compiling it. (We use `cc` only when the `pcre2` feature is
enabled.)
2024-08-28 11:38:43 -04:00
Henk-Jan Meijer
ea99421ec8
doc: fix transcription bug in ugrep benchmark command
I re-ran the benchmark and the timing remains nearly
unchanged, so that part was correct.

PR #2876
2024-08-21 13:58:36 -04:00
Cort Spellman
af8c386d5e
doc: fix typo in --heading flag help
PR #2864
2024-08-02 17:32:42 -04:00
Naser Aleisa
71d71d2d98
doc: refer to correct flag name for --engine=auto
PR #2850
2024-07-04 07:25:13 -04:00
Tobias Decking
c9ebcbd8ab
globset: optimize character escaping
Rewrites the char_to_escaped_literal and bytes_to_escaped_literal
functions in a way that minimizes heap allocations. After this, the
resulting string is the only allocation remaining.

I believe when this code was originally written, the routines available
to avoid heap allocations didn't exist.

I'm skeptical that this matters in the grand scheme of things, but I
think this is still worth doing for "good sense" reasons.

PR #2833
2024-06-05 09:56:00 -04:00
Pratham Verma
dec0dc3196
doc: update link for debian installation
PR #2829
2024-06-02 17:48:50 -04:00
Andrew Gallant
2f0a269f07
github: use an obviously old version of ripgrep in issue template
This should hopefully avoid confusion where the use of the version
number in the issue template isn't mistaken for the implication that the
version must therefore be recent.

Ref #2824
2024-05-27 18:22:11 -04:00
Andrew Gallant
0a0893a765
ignore: add debug log message when opening gitignore file
I'm not sure why it took me this long to add this debug message, but
it's quite useful in determining where ignore rules are coming from.
2024-05-27 14:53:19 -04:00
Bryan Honof
35160a1cdb
doc: add Flox as an installation method
Ref https://flox.dev/docs/

PR #2817
2024-05-24 11:59:19 -04:00
Andrew Gallant
f1d23c06e3 cli: add more logging for stdin heuristic detection
Stdin heuristic detection is complicated and opaque enough that it's
worth having easy access to the complete story that leads ripgrep to
decide whether to search stdin or not.

Ref #2806
2024-05-13 09:43:04 -04:00
tgolang
22b677900f
doc: fix some typos
PR #2754
2024-05-13 07:44:51 -04:00
NicoElbers
bb6f0f5519
doc: fix typo in --vimgrep help message
PR #2802
2024-05-11 07:02:24 -04:00
Andrew Gallant
b6ef99ee55
doc: remove unused man page template
This seems to be causing confusion. And since we don't use it as of
ripgrep 14, let's just remove it.

Man page generation is now done by ripgrep itself. That is:

    rg --generate man > rg.1

Closes #2801
2024-05-09 13:46:28 -04:00
Nicolas Holzschuch
bb8601b2ba
printer: make compilation on non-unix, non-windows platforms work
Some of the new hyperlink work caused ripgrep to stop compiling
on non-{Unix,Windows} platforms. The most popular of which is WASI.

This commit makes non-{Unix,Windows} compile again. And we add a
very basic WASI test in CI to catch regressions.

More work is needed to make tests on non-{Unix,Windows} platforms
work. And of course, this commit specifically takes the path of disabling
hyperlink support for non-{Unix,Windows} platforms.
2024-04-23 13:12:19 -04:00
Andrew Gallant
02b47b7469
deps: update everything
Notably, this removes winapi in favor of windows-sys, as a result of
winapi-util switching over to windows-sys[1].

Annoyingly, when PCRE2 is enabled, this brings in a dependency on
`once_cell`[2]. I had worked to remove it from my dependencies and now
it's back. Gah. I suppose I could disable the `parallel` feature of
`cc`, but that doesn't seem like a good trade-off.

[1]: https://github.com/BurntSushi/winapi-util/pull/13
[2]: https://github.com/rust-lang/cc-rs/pull/1037
2024-04-23 10:46:12 -04:00
redistay
d922b7ac11
doc: fix typo
PR #2776
2024-04-02 09:10:25 -04:00
Linda_pp
2acf25c689
ignore/types: add WGSL to the default file types
[WGSL][1] is a shading language for WebGPU. As defined in [Appendix
A][2], the file extension is `.wgsl`.

PR #2774 

[1]: https://www.w3.org/TR/WGSL/
[2]: https://www.w3.org/TR/WGSL/#text-wgsl-media-type
2024-04-01 23:05:15 -04:00
Vadim Kostin
80007698d3
ignore/types: add Vue
PR #2772
2024-04-01 07:49:29 -04:00
cgzones
3ad0e83471
ignore/walk: correct build_parallel() documentation
The returned closure should return `WalkState`, not `()`.

Closes #2767
2024-03-27 14:50:05 -04:00
Andrew Gallant
eca13f08a2
deps: bump everything else 2024-03-24 18:58:28 -04:00
Andrew Gallant
4f99f82b19
deps: bump pcre2 and pcre2-sys
This moves to PCRE2 10.43.
2024-03-24 18:58:06 -04:00
Anton Zhiyanov
327d74f161
doc: add link to unofficial playground
PR #2760
2024-03-20 08:11:09 -04:00
Brent Williams
9da0995df4
ignore/types: add 'svelte' to the default file types
Ref: https://svelte.dev/

PR #2759
2024-03-19 13:36:08 -04:00