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

1590 Commits

Author SHA1 Message Date
Andrew Gallant
8ec6ef373f
changelog: sync with commits since last release
I'm hoping to get a release out soon, and this is the first step.
2021-05-29 08:26:46 -04:00
Andrew Gallant
581a35e568
impl: fix --multiline anchored match bug
This fixes a bug where using \A or (?-m)^ in combination with
-U/--multiline would permit matches that aren't anchored to the
beginning of the file. The underlying cause was an optimization that
occurred when mmaps couldn't be used. Namely, ripgrep tries to still
read the input incrementally if it knows the pattern can't match through
a new line. But the detection logic was flawed, since it didn't account
for line anchors. This commit fixes that.

Fixes #1878, Fixes #1879
2021-05-29 07:37:28 -04:00
jack1142
ba965962fe
ignore/types: add po files to supported types
See: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html

Closes #1875
2021-05-28 12:06:10 -04:00
Andrew Gallant
94e4b8e301
printer: fix --vimgrep for multi-line mode
It turned out that --vimgrep wasn't quite getting the column of each
match correctly. Instead of printing column numbers relative to the
current line, it was printing column numbers as byte offsets relative to
where the match began. To fix this, we simply subtract the offset of the
line number from the beginning of the match. If the beginning of the
match came before the start of the current line, then there's really
nothing sensible we can do other than to use a column number of 1, which
we now document.

Interestingly, existing tests were checking that the previous behavior
was intended. My only defense is that I somehow tricked myself into
thinking it was a byte offset instead of a column number.

Kudos to @bfrg for calling this out in #1866:
https://github.com/BurntSushi/ripgrep/issues/1866#issuecomment-841635553
2021-05-15 08:27:59 -04:00
Alessandro Caputo
2af77242c5
doc: fix typo in --engine flag docs
Fixes #1862
2021-05-08 15:35:44 -04:00
Andrew Gallant
3f4c4188c1
deps: update to regex 1.5.2
This brings in a performance bug fix, merged in
https://github.com/rust-lang/regex/pull/768.

Fixes #1860.
2021-05-01 07:44:47 -04:00
Andrew Gallant
ce4b587055
deps: update everything
It looks like no new dependencies have been introduced. Yay!

This update was primarily motivated to bring regex 1.5 in with its new
memmem implementation from the memchr crate.
2021-04-30 20:26:32 -04:00
Eliaz Bobadilla
be63122508
doc: add links to Spanish translation
PR #1856
2021-04-21 11:14:11 -04:00
Dan Bjorge
92286ad4d2
doc: clarify --hidden definition
On Windows, we didn't previously document that ripgrep
respected both the prefix-dot convention _and_ the "hidden"
attribute on files.

Fixes #1847
2021-04-15 19:21:26 -04:00
jgart
4ebe8375ec
ignore/types: add mint
PR #1844
2021-04-04 08:00:12 -04:00
Andrew Gallant
7923d25228
core: add a 'trace' message
This message will emit the binary detection mechanism being used for
each file.

This does not noticeably increases the number of log messages, as the
'trace' level is already used for emitting messages for every file
searched.

This trace message was added in the course of investigating #1838.
2021-03-31 13:54:00 -04:00
aricha1940
1c3eebefec
searcher: update outdated comment for buffer size
Looks like this was accidentally left set to 8 in commit 46fb77c.

PR #1839
2021-03-31 08:18:38 -04:00
Andrew Gallant
64ac2ebe0f
tests: fix tests for buffer size change
Sadly, there were several tests that are coupled to the size of the
buffer used by ripgrep. Making the tests agnostic to the size is
difficult. And it's annoying to fix the tests. But we rarely change the
buffer size, so ¯\_(ツ)_/¯.
2021-03-23 18:14:18 -04:00
Andrew Gallant
46fb77c20c
searcher: bump buffer size
This increases the initial buffer size from 8KB to 64KB. This actually
leads to a reasonably noticeable improvement in at least one work-load,
and is unlikely to regress in any other case. Also, since Rust programs
(at least on Linux) seem to always use a minimum of 6-8MB of memory,
adding an extra 56KB is negligible.

Before:

    $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap"
    Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap
      Time (mean ± σ):      2.109 s ±  0.012 s    [User: 565.5 ms, System: 1541.6 ms]
      Range (min … max):    2.094 s …  2.128 s    10 runs

After:

    $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap"
    Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap
      Time (mean ± σ):      1.802 s ±  0.006 s    [User: 462.3 ms, System: 1337.9 ms]
      Range (min … max):    1.795 s …  1.814 s    10 runs
2021-03-23 17:45:02 -04:00
Allen Wild
6a1c3253e0
ci: fix deb build script in clean checkout
If ripgrep hasn't been built yet (i.e. target/debug/ doesn't exist),
then cargo-out-dir can't find OUT_DIR and the copy commands fail. Fix by
running cargo build before finding OUT_DIR.

Also add a check to fail early with a sensible error message when
asciidoctor isn't installed, rather than failing because of a missing
rg.1 file after the build.

PR #1831
2021-03-20 13:37:50 -04:00
Andrew Gallant
c7730d1f3a
deps: bump regex and regex-syntax 2021-03-11 21:20:25 -05:00
Hanif Ariffin
c5ea5a13df
gitignore: add HTML files generated by cargo -Z timings
PR #1801
2021-02-12 11:09:56 -05:00
Sergei Vorobev
9c8d873a75
ignore/types: improve bazel globs
Adds *.BUILD and *.bazelrc.

PR #1789
2021-01-30 18:22:48 -05:00
Andrew Gallant
7899a4b931
regex: s/CachedThreadLocal/ThreadLocal
CachedThreadLocal has been deprecated. We bump thread_local's minimal
version corresponding to that deprecation as well.
2021-01-25 10:38:05 -05:00
Andrew Gallant
ae55a4e872
deps: update everything
Most of these updates come from releases I've made, and the rest appear
minor. No new dependencies have been added, and `const_fn` was removed.
Yay.
2021-01-17 18:55:17 -05:00
Andrew Gallant
3a1780d841
deps: replace memmap with memmap2
memmap is unmaintained at this point and it is being flagged as a
RUSTSEC advisory in ripgrep. This doesn't seem like that big of a deal
to me honestly, but memmap2 looks like a fine choice at this point.

Fixes #1785, Closes #1786
2021-01-17 18:49:51 -05:00
Andrew Gallant
a6d05475fb
ignore-0.4.17 2020-11-23 10:25:33 -05:00
Roey Darwish Dror
020c5453a5
cli: fix stdin detection for Powershell on Unix
It seems that PowerShell uses sockets instead of FIFOs to redirect the
output between commands. So add `is_socket` to our `is_readable_stdin`
check.

This seems unlikely to cause problems and it probably more generally
correct than what we had before. In theory, it could cause problems if
it produces false positives, in which case, ripgrep will try to read
stdin when it should search the current working directory. (And this
usually winds up manifesting as ripgrep blocking forever.) But, if the
stdin handle reports itself as a socket, then it seems like we should
read it.

Fixes #1741, Closes #1742
2020-11-23 10:23:34 -05:00
Ed Page
873abecbf1
ignore: provide underlying IO Error
`ignore::Error` wraps `std::io::Error` with additional information
(as well as expose non-IO errors). For people wanting to inspect what
the error is, they have to recursively match the Enum. This provides
`io_error` and `into_io_error` helpers to do this for the user.

PR #1740
2020-11-23 10:19:31 -05:00
tleb
8c73833efc
readme: fix link to .deb
This is a common thing to forget to do after a release.
2020-11-22 09:56:02 -05:00
James Harr
44e69ba627
ignore/types: add yang file type
YANG is described in RFC 6020
https://tools.ietf.org/html/rfc6020

PR #1736
2020-11-20 09:41:29 -05:00
Andrew Gallant
13d77ab646
ci: update to GITHUB_ENV
Apparently ::set-env has been completely disabled. Sigh.
2020-11-16 19:17:36 -05:00
Andrew Gallant
d97fb72d84
doc: update CI links in crate READMEs
I switched to GitHub Actions long ago, which replaces both Travis and
AppVeyor.

Fixes #1732
2020-11-16 19:07:16 -05:00
Andrew Gallant
d6365117e2
doc: sync --help output with man page
The man page had the correct usage hints, but the -h/--help output was
using an older more incorrect version of the hints.

Closes #1730 (again)
2020-11-15 15:27:23 -05:00
Andrew Gallant
f32e906012
doc: clarify that CLI invocation must always be valid
This comes up as a corner case where folks provide -e/--regexp in a
configuration file and then expect to be able to run 'rg' with no args.
However, ripgrep fails because it still expects at least one pattern
even though one was specified in the config file.

This occurs because ripgrep has to parse its CLI parameters before
reading the config file. (For log output settings and to handle the
--no-config flag.) This initial parse will fail if there are no patterns
specified.

The only way to solve this that I can see is to somehow relax the
requirements of the initial parse. But this is problematic because we
would still need to enforce those requirements in cases where we don't
do a second parse (when no config file is present).

All in all, this doesn't seem like a problem that is worth solving.

Closes #1730
2020-11-15 15:00:08 -05:00
Taiki Endo
59644d4592
ci: install cross from crates.io
A new release of cross has been put out, so we
no longer need to install it from git.

PR #1728
2020-11-09 07:25:41 -05:00
Alex Touchet
3ca324fda7
doc: update several links to use https
PR #1724
2020-11-03 10:33:36 -05:00
Stefan VanBuren
8782f8200c
doc: add missing backtick in FAQ
PR #1723
2020-11-03 10:32:38 -05:00
Andrew Gallant
2819212f89 printer: tweak binary detection message format
This roughly matches similar changes made in GNU grep recently.
2020-11-02 10:52:51 -05:00
Andrew Gallant
810be0b348 deps: update base64 to 0.13.0 2020-11-02 10:52:51 -05:00
Andrew Gallant
a28bb1e953 deps: bring in all semver updates
This brings in all other semver updates.

This did require updating some tests, since bstr changed its debug
output for NUL bytes to be a bit more idiomatic.
2020-11-02 10:52:51 -05:00
Andrew Gallant
3ef63dacbe deps: targeted update of some dependencies
This updates encoding_rs, crossbeam-utils and crossbeam-channel. This
serves two purposes. The encoding_rs update fixes a compilation failure
on the latest nightly. The crossbeam updates are good sense and to
reduce duplicate dependencies such as cfg-if. (Although, we note that
the log crate still pulls in cfg-if 0.1, so ripgrep has a duplicate
dependency there for now. But it's very small.)

Fixes #1721, Closes #1705
2020-11-02 10:52:51 -05:00
Vanessa McHale
e1ac18ef06
ignore/types: add Futhark
See: https://futhark-lang.org/

PR #1720
2020-10-31 12:10:15 -04:00
Brandon Adams
ba3f9673ad
ignore/types: generalize bazel type a bit
Bazel supports `BUILD.bazel` as well as `WORKSPACE.bazel`. In
addition, it is common to ship BUILD/WORKSPACE templates for
external repositories suffixed with .bazel for easier tool
recognition.

Co-authored-by: Brandon Adams <brandon.adams@imc.com>

PR #1716
2020-10-23 12:24:30 -04:00
Andrew Gallant
c777e2cd57
globset-0.4.6 2020-10-21 21:10:43 -04:00
Ajeet D'Souza
e5639cf22d
globset: remove regex unicode dependency
Since the translation from a glob to a regex always
disables Unicode in the regex, it follows that we shouldn't
need regex's Unicode features enabled.

Now, ripgrep enables Unicode features in its regex
dependency and of course uses them, which will cause
globset to have it enabled in the ripgrep build as well. So
this doesn't actually change anything for ripgrep. But this
does slim thing downs for folks using globset independently
of ripgrep.

PR #1712
2020-10-19 14:29:05 -04:00
Dương Đỗ Minh Châu
86c843a44b
ignore/types: add a type for minified files
Fixes #1710, PR #1711
2020-10-19 09:10:54 -04:00
Andrew Gallant
2b1637d1db
doc: clarify how -S/--smart-case works
Whether or not smart case kicks in can be a little subtle in some cases.
So we document the specific conditions in which it applies. These
conditions were taken directly from the public API docs of the
`grep-regex` crate:
https://docs.rs/grep-regex/0.1.8/grep_regex/struct.RegexMatcherBuilder.html#method.case_smart

Fixes #1708
2020-10-17 18:55:44 -04:00
Andrew Pyatkov
6301e20ee4
ignore/types: add flatbuffers type
See: https://google.github.io/flatbuffers/

PR #1707
2020-10-16 20:19:16 -04:00
dana
145cef2eff
doc: elaborate on the function of -u/--unrestricted
Fixes #1703
2020-10-16 09:52:42 -04:00
Andrew Gallant
20534fad04
benchsuite/runs: add updated benchmark, with ugrep 2020-10-14 17:01:45 -04:00
Andrew Gallant
de0c24f31c
benchsuite: add ugrep commands to benchmarks 2020-10-14 17:00:35 -04:00
Andrew Gallant
c55e7af675
benchsuite: remove -a flag from grep
It's not quite clear why I added this originally. ripgrep doesn't have
its `-a` flag enabled. It's possible I tricked myself into adding it
because ripgrep's binary detection has evolved to be more like GNU
grep's nowadays.

In any case, using `-a` on data that is non-binary can only improve
performance because it removes the overhead for checking whether the
data is binary or not. So this was giving an artificial boost to GNU
grep.
2020-10-14 15:16:25 -04:00
Andrew Gallant
5ebb3ad039
benchsuite: remove sift, pt and ucg
None of these tools got particularly popular (except for pt briefly),
but they do not appear to be active projects nowadays. While ucg was
fast, sift and pt were ecscruiating slow in a number of cases that
required special care in the benchmarks.

This also fixes the ordering of benchmark output to reflect the ordering
in the source of the benchsuite script.
2020-10-14 15:16:07 -04:00
Andrew Gallant
b0066274cb
benchsuite: update subtitle URLs
Since the English subtitle file actually changed its content, we tweak
the benchmark to use a slightly bigger sample that more closely matches
the file size of the Russian subtitle file.

Also, the BurntSushi/linux repo has been updated and I've confirmed that
it builds on my Linux machine.

Fixes #1257
2020-10-14 14:17:23 -04:00