Compare commits

...

10 Commits

Author SHA1 Message Date
Andrew Gallant
543f99dbf1 grep-regex-0.1.7 2020-03-22 21:08:19 -04:00
Andrew Gallant
0ea65efd6d regex: special case literal extraction
In a prior commit, we fixed a performance problem with the -w flag by
doing a little extra work to extract literals. It turns out that using
literals in this case when the -w flag is NOT used results in a
performance regression. The reasoning is that we end up using a "fast"
regex as a prefilter when the regex engine itself uses its own
equivalent prefilter, so ripgrep ends up redoing a fair amount of work.

Instead, we only do this extra work when we know the -w flag is enabled.
2020-03-22 21:02:51 -04:00
Paul A. Patience
20deae6497 tests: fix typo in test name
PR #1528
2020-03-22 07:43:16 -04:00
Andrew Gallant
655e33219a crates.io: remove badges
... and don't replace them with anything because crates.io does not
support GitHub Actions yet. But it's almost there:
https://github.com/rust-lang/crates.io/pull/1838

Thanks @atouchet for noticing this.
2020-03-17 17:50:37 -04:00
Andrew Gallant
8ba6ccd159 ignore: fix failing test
This fixes fallout from fixing #1520.
2020-03-16 19:16:24 -04:00
Andrew Gallant
34edb8123a ignore: squash noisy error message
We should not assume that the commondir file actually exists. If it
doesn't, then just move on. This otherwise emits an error message when
searching normal submodules, which is not OK.

This regression was introduced in #1446.

Fixes #1520
2020-03-16 18:50:02 -04:00
Andrew Gallant
5b30c2aed6 ci: fix deb build script 2020-03-15 22:11:32 -04:00
Andrew Gallant
bf1027a83e pkg: update brew tap to 12.0.0 2020-03-15 22:10:08 -04:00
Andrew Gallant
031264e5fb ci: tweak release name
This is consistent with prior releases.
2020-03-15 22:07:22 -04:00
Andrew Gallant
b9cd95faf1 release: 12.0.0, take 2 2020-03-15 21:54:11 -04:00
10 changed files with 36 additions and 36 deletions

View File

@@ -22,7 +22,7 @@ jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
env:
# env:
# Set to force version number, e.g., when no tag exists.
# RG_VERSION: TEST-0.0.0
steps:
@@ -45,7 +45,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RG_VERSION }}
release_name: ripgrep ${{ env.RG_VERSION }}
release_name: ${{ env.RG_VERSION }}
- name: Save release upload URL to artifact
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url

View File

@@ -1,3 +1,14 @@
12.0.1 (TBD)
============
ripgrep 12.0.1 is a small patch release that includes a couple minor bug fixes.
These bug fixes address regressions introduced in the 12.0.0 release.
Bug fixes:
* [BUG #1520](https://github.com/BurntSushi/ripgrep/issues/1520):
Don't emit spurious error messages in git repositories with submodules.
12.0.0 (2020-03-15)
===================
ripgrep 12 is a new major version release of ripgrep that contains many bug

8
Cargo.lock generated
View File

@@ -148,7 +148,7 @@ dependencies = [
"grep-matcher 0.1.4",
"grep-pcre2 0.1.4",
"grep-printer 0.1.4",
"grep-regex 0.1.6",
"grep-regex 0.1.7",
"grep-searcher 0.1.7",
"termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -192,7 +192,7 @@ dependencies = [
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"grep-matcher 0.1.4",
"grep-regex 0.1.6",
"grep-regex 0.1.7",
"grep-searcher 0.1.7",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -202,7 +202,7 @@ dependencies = [
[[package]]
name = "grep-regex"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -222,7 +222,7 @@ dependencies = [
"encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs_io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"grep-matcher 0.1.4",
"grep-regex 0.1.6",
"grep-regex 0.1.7",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.5 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@@ -20,8 +20,8 @@ autotests = false
edition = "2018"
[badges]
travis-ci = { repository = "BurntSushi/ripgrep" }
appveyor = { repository = "BurntSushi/ripgrep" }
# I guess crates.io does not support GitHub Action badges yet.
# Tracking PR: https://github.com/rust-lang/crates.io/pull/1838
[[bin]]
bench = false

View File

@@ -29,7 +29,8 @@ mkdir -p "$DEPLOY_DIR"
cargo build
# Copy man page and shell completions.
cp "$OUT_DIR"/{rg.1,rg.bash,rg.fish,_rg} "$DEPLOY_DIR/"
cp "$OUT_DIR"/{rg.1,rg.bash,rg.fish} "$DEPLOY_DIR/"
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.

View File

@@ -310,7 +310,7 @@ impl Ignore {
git_global_matcher: self.0.git_global_matcher.clone(),
git_ignore_matcher: gi_matcher,
git_exclude_matcher: gi_exclude_matcher,
has_git: has_git,
has_git,
opts: self.0.opts,
};
(ig, errs.into_error_option())
@@ -817,9 +817,7 @@ fn resolve_git_commondir(
let git_commondir_file = || real_git_dir.join("commondir");
let file = match File::open(git_commondir_file()) {
Ok(file) => io::BufReader::new(file),
Err(err) => {
return Err(Some(Error::Io(err).with_path(git_commondir_file())));
}
Err(_) => return Err(None),
};
let commondir_line = match file.lines().next() {
Some(Ok(line)) => line,
@@ -839,7 +837,7 @@ fn resolve_git_commondir(
#[cfg(test)]
mod tests {
use std::fs::{self, File};
use std::io::{self, Write};
use std::io::Write;
use std::path::Path;
use dir::IgnoreBuilder;
@@ -1172,22 +1170,9 @@ mod tests {
// missing commondir file
assert!(fs::remove_file(commondir_path()).is_ok());
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
assert!(err.is_some());
assert!(match err {
Some(Error::WithPath { path, err }) => {
if path != commondir_path() {
false
} else {
match *err {
Error::Io(ioerr) => {
ioerr.kind() == io::ErrorKind::NotFound
}
_ => false,
}
}
}
_ => false,
});
// We squash the error in this case, because it occurs in repositories
// that are not linked worktrees but have submodules.
assert!(err.is_none());
wfile(td.path().join("linked-worktree/.git"), "garbage");
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
@@ -1195,6 +1180,6 @@ mod tests {
wfile(td.path().join("linked-worktree/.git"), "gitdir: garbage");
let (_, err) = ib.add_child(td.path().join("linked-worktree"));
assert!(err.is_some());
assert!(err.is_none());
}
}

View File

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

View File

@@ -141,6 +141,9 @@ impl LiteralSets {
// (Not in theory---it could be better. But the current
// implementation isn't good enough.) ... So we make up for it
// here.
if !word {
return None;
}
let p_min_len = self.prefixes.min_len();
let s_min_len = self.suffixes.min_len();
let lits = match (p_min_len, s_min_len) {

View File

@@ -1,14 +1,14 @@
class RipgrepBin < Formula
version '11.0.2'
version '12.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 "0ba26423691deedf2649b12b1abe3d2be294ee1cb17c40b68fe85efe194f4f57"
sha256 "ebbc518ac019fc78b6429ec2e64b823c59b15a6f942436f43b9afc23c9aad9ea"
elsif OS.linux?
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
sha256 "2e7978e346553fbc45c0940d9fa11e12f9afbae8213b261aad19b698150e169a"
sha256 "ab3c8b4b030102d8fcdde62d3467ea5219e65aa3b42d268e85e9d1c14624149a"
end
conflicts_with "ripgrep"

View File

@@ -511,7 +511,7 @@ rgtest!(context_line_numbers, |dir: Dir, mut cmd: TestCommand| {
eqnice!(expected, cmd.stdout());
});
rgtest!(max_filesize_parse_errro_length, |_: Dir, mut cmd: TestCommand| {
rgtest!(max_filesize_parse_error_length, |_: Dir, mut cmd: TestCommand| {
cmd.arg("--max-filesize").arg("44444444444444444444");
cmd.assert_non_empty_stderr();
});