Skip to content

Commit 02b402a

Browse files
committed
Merge branch 'master' of https://github.com/burntsushi/ripgrep
2 parents 271abb8 + 9f924ee commit 02b402a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2115
-752
lines changed

.cargo/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# On Windows MSVC, statically link the C runtime so that the resulting EXE does
2+
# not depend on the vcruntime DLL.
3+
#
4+
# See: https://github.com/BurntSushi/ripgrep/pull/1613
5+
[target.x86_64-pc-windows-msvc]
6+
rustflags = ["-C", "target-feature=+crt-static"]
7+
[target.i686-pc-windows-msvc]
8+
rustflags = ["-C", "target-feature=+crt-static"]

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ examples of how ripgrep would be used if your feature request were added.
1515
If you're not sure what to write here, then try imagining what the ideal
1616
documentation of your new feature would look like in ripgrep's man page. Then
1717
try to write it.
18+
19+
If you're requesting the addition or change of default file types, please open
20+
a PR. We can discuss it there if necessary.

.github/workflows/ci.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
include:
4444
- build: pinned
4545
os: ubuntu-18.04
46-
rust: 1.41.0
46+
rust: 1.52.1
4747
- build: stable
4848
os: ubuntu-18.04
4949
rust: stable
@@ -118,10 +118,10 @@ jobs:
118118
echo "target flag is: ${{ env.TARGET_FLAGS }}"
119119
120120
- name: Build ripgrep and all crates
121-
run: ${{ env.CARGO }} build --verbose --all ${{ env.TARGET_FLAGS }}
121+
run: ${{ env.CARGO }} build --verbose --workspace ${{ env.TARGET_FLAGS }}
122122

123123
- name: Build ripgrep with PCRE2
124-
run: ${{ env.CARGO }} build --verbose --all --features pcre2 ${{ env.TARGET_FLAGS }}
124+
run: ${{ env.CARGO }} build --verbose --workspace --features pcre2 ${{ env.TARGET_FLAGS }}
125125

126126
# This is useful for debugging problems when the expected build artifacts
127127
# (like shell completions and man pages) aren't generated.
@@ -139,15 +139,15 @@ jobs:
139139
140140
- name: Run tests with PCRE2 (sans cross)
141141
if: matrix.target == ''
142-
run: ${{ env.CARGO }} test --verbose --all --features pcre2 ${{ env.TARGET_FLAGS }}
142+
run: ${{ env.CARGO }} test --verbose --workspace --features pcre2 ${{ env.TARGET_FLAGS }}
143143

144144
- name: Run tests without PCRE2 (with cross)
145145
# These tests should actually work, but they almost double the runtime.
146146
# Every integration test spins up qemu to run 'rg', and when PCRE2 is
147147
# enabled, every integration test is run twice: one with the default
148148
# regex engine and once with PCRE2.
149149
if: matrix.target != ''
150-
run: ${{ env.CARGO }} test --verbose --all ${{ env.TARGET_FLAGS }}
150+
run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }}
151151

152152
- name: Test for existence of build artifacts (Windows)
153153
if: matrix.os == 'windows-2019'
@@ -194,3 +194,20 @@ jobs:
194194
- name: Check formatting
195195
run: |
196196
cargo fmt --all -- --check
197+
198+
docs:
199+
name: Docs
200+
runs-on: ubuntu-20.04
201+
steps:
202+
- name: Checkout repository
203+
uses: actions/checkout@v2
204+
- name: Install Rust
205+
uses: actions-rs/toolchain@v1
206+
with:
207+
toolchain: stable
208+
profile: minimal
209+
override: true
210+
- name: Check documentation
211+
env:
212+
RUSTDOCFLAGS: -D warnings
213+
run: cargo doc --no-deps --document-private-items --workspace

.github/workflows/release.yml

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
1-
# The way this works is a little weird. But basically, the create-release job
2-
# runs purely to initialize the GitHub release itself. Once done, the upload
3-
# URL of the release is saved as an artifact.
1+
# The way this works is the following:
42
#
5-
# The build-release job runs only once create-release is finished. It gets
6-
# the release upload URL by downloading the corresponding artifact (which was
7-
# uploaded by create-release). It then builds the release executables for each
8-
# supported platform and attaches them as release assets to the previously
9-
# created release.
3+
# The create-release job runs purely to initialize the GitHub release itself
4+
# and to output upload_url for the following job.
5+
#
6+
# The build-release job runs only once create-release is finished. It gets the
7+
# release upload URL from create-release job outputs, then builds the release
8+
# executables for each supported platform and attaches them as release assets
9+
# to the previously created release.
1010
#
1111
# The key here is that we create the release only once.
12+
#
13+
# Reference:
14+
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/
1215

1316
name: release
1417
on:
1518
push:
1619
# Enable when testing release infrastructure on a branch.
1720
# branches:
18-
# - ag/release
21+
# - ag/work
1922
tags:
20-
- '[0-9]+.[0-9]+.[0-9]+'
23+
- "[0-9]+.[0-9]+.[0-9]+"
2124
jobs:
2225
create-release:
2326
name: create-release
2427
runs-on: ubuntu-latest
2528
# env:
2629
# Set to force version number, e.g., when no tag exists.
2730
# RG_VERSION: TEST-0.0.0
31+
outputs:
32+
upload_url: ${{ steps.release.outputs.upload_url }}
33+
rg_version: ${{ env.RG_VERSION }}
2834
steps:
29-
- name: Create artifacts directory
30-
run: mkdir artifacts
31-
3235
- name: Get the release version from the tag
36+
shell: bash
3337
if: env.RG_VERSION == ''
3438
run: |
3539
# Apparently, this is the right way to get a tag name. Really?
3640
#
3741
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
3842
echo "RG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
3943
echo "version is: ${{ env.RG_VERSION }}"
40-
4144
- name: Create GitHub release
4245
id: release
4346
uses: actions/create-release@v1
@@ -47,18 +50,6 @@ jobs:
4750
tag_name: ${{ env.RG_VERSION }}
4851
release_name: ${{ env.RG_VERSION }}
4952

50-
- name: Save release upload URL to artifact
51-
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url
52-
53-
- name: Save version number to artifact
54-
run: echo "${{ env.RG_VERSION }}" > artifacts/release-version
55-
56-
- name: Upload artifacts
57-
uses: actions/upload-artifact@v1
58-
with:
59-
name: artifacts
60-
path: artifacts
61-
6253
build-release:
6354
name: build-release
6455
needs: ['create-release']
@@ -68,7 +59,7 @@ jobs:
6859
# systems.
6960
CARGO: cargo
7061
# When CARGO is set to CROSS, this is set to `--target matrix.target`.
71-
TARGET_FLAGS:
62+
TARGET_FLAGS: ""
7263
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
7364
TARGET_DIR: ./target
7465
# Emit backtraces on panics.
@@ -129,7 +120,7 @@ jobs:
129120
target: ${{ matrix.target }}
130121

131122
- name: Use Cross
132-
# if: matrix.os != 'windows-2019'
123+
shell: bash
133124
run: |
134125
cargo install cross
135126
echo "CARGO=cross" >> $GITHUB_ENV
@@ -142,22 +133,6 @@ jobs:
142133
echo "target flag is: ${{ env.TARGET_FLAGS }}"
143134
echo "target dir is: ${{ env.TARGET_DIR }}"
144135
145-
- name: Get release download URL
146-
uses: actions/download-artifact@v1
147-
with:
148-
name: artifacts
149-
path: artifacts
150-
151-
- name: Set release upload URL and release version
152-
shell: bash
153-
run: |
154-
release_upload_url="$(cat artifacts/release-upload-url)"
155-
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
156-
echo "release upload url: $RELEASE_UPLOAD_URL"
157-
release_version="$(cat artifacts/release-version)"
158-
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
159-
echo "release version: $RELEASE_VERSION"
160-
161136
- name: Build release binary
162137
run: ${{ env.CARGO }} build --verbose --release --features pcre2 ${{ env.TARGET_FLAGS }}
163138

@@ -178,7 +153,7 @@ jobs:
178153
shell: bash
179154
run: |
180155
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
181-
staging="ripgrep-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
156+
staging="ripgrep-${{ needs.create-release.outputs.rg_version }}-${{ matrix.target }}"
182157
mkdir -p "$staging"/{complete,doc}
183158
184159
cp {README.md,COPYING,UNLICENSE,LICENSE-MIT} "$staging/"
@@ -203,7 +178,7 @@ jobs:
203178
env:
204179
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
205180
with:
206-
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
181+
upload_url: ${{ needs.create-release.outputs.upload_url }}
207182
asset_path: ${{ env.ASSET }}
208183
asset_name: ${{ env.ASSET }}
209184
asset_content_type: application/octet-stream

CHANGELOG.md

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
TBD
22
===
3-
Unreleased changes. Release notes have not yet been written.
3+
ripgrep 13 is a new major version release of ripgrep that primarily contains
4+
bug fixes. There is also a fix for a security vulnerability on Windows
5+
([CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013)),
6+
some performance improvements and some minor breaking changes.
7+
8+
A new short flag, `-.`, has been added. It is an alias for the `--hidden` flag,
9+
which instructs ripgrep to search hidden files and directories.
10+
11+
ripgrep is now using a new
12+
[vectorized implementation of `memmem`](https://github.com/BurntSushi/memchr/pull/82),
13+
which accelerates many common searches. If you notice any performance
14+
regressions (or major improvements), I'd love to hear about them through an
15+
issue report!
16+
17+
Also, for Windows users targeting MSVC, Cargo will now build fully static
18+
executables of ripgrep. The release binaries for ripgrep 13 have been compiled
19+
using this configuration.
20+
21+
**BREAKING CHANGES**:
22+
23+
**Binary detection output has changed slightly.**
424

525
In this release, a small tweak has been made to the output format when a binary
626
file is detected. Previously, it looked like this:
@@ -15,12 +35,100 @@ Now it looks like this:
1535
FOO: binary file matches (found "\0" byte around offset XXX)
1636
```
1737

38+
**vimgrep output in multi-line now only prints the first line for each match.**
39+
40+
See [issue 1866](https://github.com/BurntSushi/ripgrep/issues/1866) for more
41+
discussion on this. Previously, every line in a match was duplicated, even
42+
when it spanned multiple lines. There are no changes to vimgrep output when
43+
multi-line mode is disabled.
44+
45+
**In multi-line mode, --count is now equivalent to --count-matches.**
46+
47+
This appears to match how `pcre2grep` implements `--count`. Previously, ripgrep
48+
would produce outright incorrect counts. Another alternative would be to simply
49+
count the number of lines---even if it's more than the number of matches---but
50+
that seems highly unintuitive.
51+
52+
**FULL LIST OF FIXES AND IMPROVEMENTS:**
53+
54+
Security fixes:
55+
56+
* [CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013):
57+
Fixes a security hole on Windows where running ripgrep with either the
58+
`-z/--search-zip` or `--pre` flags can result in running arbitrary
59+
executables from the current directory.
60+
* [VULN #1773](https://github.com/BurntSushi/ripgrep/issues/1773):
61+
This is the public facing issue tracking CVE-2021-3013. ripgrep's README
62+
now contains a section describing how to report a vulnerability.
63+
64+
Performance improvements:
65+
66+
* [PERF #1657](https://github.com/BurntSushi/ripgrep/discussions/1657):
67+
Check if a file should be ignored first before issuing stat calls.
68+
* [PERF memchr#82](https://github.com/BurntSushi/memchr/pull/82):
69+
ripgrep now uses a new vectorized implementation of `memmem`.
70+
71+
Feature enhancements:
72+
73+
* Added or improved file type filtering for ASP, Bazel, dvc, FlatBuffers,
74+
Futhark, minified files, Mint, pofiles (from GNU gettext) Racket, Red, Ruby,
75+
VCL, Yang.
76+
* [FEATURE #1404](https://github.com/BurntSushi/ripgrep/pull/1404):
77+
ripgrep now prints a warning if nothing is searched.
78+
* [FEATURE #1613](https://github.com/BurntSushi/ripgrep/pull/1613):
79+
Cargo will now produce static executables on Windows when using MSVC.
80+
* [FEATURE #1680](https://github.com/BurntSushi/ripgrep/pull/1680):
81+
Add `-.` as a short flag alias for `--hidden`.
82+
* [FEATURE #1842](https://github.com/BurntSushi/ripgrep/issues/1842):
83+
Add `--field-{context,match}-separator` for customizing field delimiters.
84+
* [FEATURE #1856](https://github.com/BurntSushi/ripgrep/pull/1856):
85+
The README now links to a
86+
[Spanish translation](https://github.com/UltiRequiem/traducciones/tree/master/ripgrep).
87+
1888
Bug fixes:
1989

2090
* [BUG #1277](https://github.com/BurntSushi/ripgrep/issues/1277):
2191
Document cygwin path translation behavior in the FAQ.
92+
* [BUG #1739](https://github.com/BurntSushi/ripgrep/issues/1739):
93+
Fix bug where replacements were buggy if the regex matched a line terminator.
94+
* [BUG #1311](https://github.com/BurntSushi/ripgrep/issues/1311):
95+
Fix multi-line bug where a search & replace for `\n` didn't work as expected.
96+
* [BUG #1401](https://github.com/BurntSushi/ripgrep/issues/1401):
97+
Fix buggy interaction between PCRE2 look-around and `-o/--only-matching`.
98+
* [BUG #1412](https://github.com/BurntSushi/ripgrep/issues/1412):
99+
Fix multi-line bug with searches using look-around past matching lines.
100+
* [BUG #1577](https://github.com/BurntSushi/ripgrep/issues/1577):
101+
Fish shell completions will continue to be auto-generated.
102+
* [BUG #1642](https://github.com/BurntSushi/ripgrep/issues/1642):
103+
Fixes a bug where using `-m` and `-A` printed more matches than the limit.
104+
* [BUG #1703](https://github.com/BurntSushi/ripgrep/issues/1703):
105+
Clarify the function of `-u/--unrestricted`.
106+
* [BUG #1708](https://github.com/BurntSushi/ripgrep/issues/1708):
107+
Clarify how `-S/--smart-case` works.
108+
* [BUG #1730](https://github.com/BurntSushi/ripgrep/issues/1730):
109+
Clarify that CLI invocation must always be valid, regardless of config file.
22110
* [BUG #1741](https://github.com/BurntSushi/ripgrep/issues/1741):
23111
Fix stdin detection when using PowerShell in UNIX environments.
112+
* [BUG #1756](https://github.com/BurntSushi/ripgrep/pull/1756):
113+
Fix bug where `foo/**` would match `foo`, but it shouldn't.
114+
* [BUG #1765](https://github.com/BurntSushi/ripgrep/issues/1765):
115+
Fix panic when `--crlf` is used in some cases.
116+
* [BUG #1638](https://github.com/BurntSushi/ripgrep/issues/1638):
117+
Correctly sniff UTF-8 and do transcoding, like we do for UTF-16.
118+
* [BUG #1816](https://github.com/BurntSushi/ripgrep/issues/1816):
119+
Add documentation for glob alternate syntax, e.g., `{a,b,..}`.
120+
* [BUG #1847](https://github.com/BurntSushi/ripgrep/issues/1847):
121+
Clarify how the `--hidden` flag works.
122+
* [BUG #1866](https://github.com/BurntSushi/ripgrep/issues/1866#issuecomment-841635553):
123+
Fix bug when computing column numbers in `--vimgrep` mode.
124+
* [BUG #1868](https://github.com/BurntSushi/ripgrep/issues/1868):
125+
Fix bug where `--passthru` and `-A/-B/-C` did not override each other.
126+
* [BUG #1869](https://github.com/BurntSushi/ripgrep/pull/1869):
127+
Clarify docs for `--files-with-matches` and `--files-without-match`.
128+
* [BUG #1878](https://github.com/BurntSushi/ripgrep/issues/1878):
129+
Fix bug where `\A` could produce unanchored matches in multiline search.
130+
* [BUG 94e4b8e3](https://github.com/BurntSushi/ripgrep/commit/94e4b8e3):
131+
Fix column numbers with `--vimgrep` is used with `-U/--multiline`.
24132

25133

26134
12.1.1 (2020-05-29)

0 commit comments

Comments
 (0)