parent
b6c077f096
commit
d5a749f3d0
@ -1,3 +1,4 @@
|
||||
/ripgrep-0.7.1.crate
|
||||
/ripgrep-0.8.0.crate
|
||||
/ripgrep-0.8.1.crate
|
||||
/ripgrep-0.9.0.crate
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 1f70e9187ceca65e7196f65e8cad1cba65efb47c Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Gallant <jamslam@gmail.com>
|
||||
Date: Sat, 10 Mar 2018 14:02:06 -0500
|
||||
Subject: [PATCH] deps: update regex crate
|
||||
|
||||
This update brings with it a new feature of the regex crate which will
|
||||
now use SIMD optimizations automatically at runtime with no necessary
|
||||
compile time flags. All that's needed is to enable the `unstable` feature.
|
||||
|
||||
Other crates, such as bytecount and encoding_rs, are still using the
|
||||
old-style SIMD support, so we leave the simd-accel and avx-accel features.
|
||||
However, the binaries we distribute on Github no longer have those
|
||||
features enabled, which makes them truly portable.
|
||||
|
||||
Fixes #135
|
||||
---
|
||||
src/args.rs | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/args.rs b/src/args.rs
|
||||
index d2077d678b9d..c7b31dd3646e 100644
|
||||
--- a/src/args.rs
|
||||
+++ b/src/args.rs
|
||||
@@ -599,7 +599,7 @@ impl<'a> ArgMatches<'a> {
|
||||
// This would normally just be an empty string, which works on its
|
||||
// own, but if the patterns are joined in a set of alternations, then
|
||||
// you wind up with `foo|`, which is invalid.
|
||||
- self.word_pattern("z{0}".to_string())
|
||||
+ self.word_pattern("(?:z{0})*".to_string())
|
||||
}
|
||||
|
||||
/// Returns true if and only if file names containing each match should
|
||||
--
|
||||
2.14.3
|
||||
|
@ -1,83 +0,0 @@
|
||||
From cd08707c7c82058559bd5557efb3c1d0379dbf1d Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Gallant <jamslam@gmail.com>
|
||||
Date: Tue, 13 Mar 2018 20:38:50 -0400
|
||||
Subject: [PATCH] grep: upgrade to regex-syntax 0.5
|
||||
|
||||
This update brings with it many bug fixes:
|
||||
|
||||
* Better error messages are printed overall. We also include
|
||||
explicit call out for unsupported features like backreferences
|
||||
and look-around.
|
||||
* Regexes like `\s*{` no longer emit incomprehensible errors.
|
||||
* Unicode escape sequences, such as `\u{..}` are now supported.
|
||||
|
||||
For the most part, this upgrade was done in a straight-forward way. We
|
||||
resist the urge to refactor the `grep` crate, in anticipation of it
|
||||
being rewritten anyway.
|
||||
|
||||
Note that we removed the `--fixed-strings` suggestion whenever a regex
|
||||
syntax error occurs. In practice, I've found that it results in a lot of
|
||||
false positives, and I believe that its use is not as paramount now that
|
||||
regex parse errors are much more readable.
|
||||
|
||||
Closes #268, Closes #395, Closes #702, Closes #853
|
||||
---
|
||||
src/args.rs | 13 ++-----------
|
||||
tests/tests.rs | 10 ----------
|
||||
2 files changed, 2 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/src/args.rs b/src/args.rs
|
||||
index c7b31dd3646e..2bbabf1a3b76 100644
|
||||
--- a/src/args.rs
|
||||
+++ b/src/args.rs
|
||||
@@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use clap;
|
||||
use encoding_rs::Encoding;
|
||||
-use grep::{Grep, GrepBuilder, Error as GrepError};
|
||||
+use grep::{Grep, GrepBuilder};
|
||||
use log;
|
||||
use num_cpus;
|
||||
use regex;
|
||||
@@ -882,16 +882,7 @@ impl<'a> ArgMatches<'a> {
|
||||
if let Some(limit) = self.regex_size_limit()? {
|
||||
gb = gb.size_limit(limit);
|
||||
}
|
||||
- gb.build().map_err(|err| {
|
||||
- match err {
|
||||
- GrepError::Regex(err) => {
|
||||
- let s = format!("{}\n(Hint: Try the --fixed-strings flag \
|
||||
- to search for a literal string.)", err.to_string());
|
||||
- From::from(s)
|
||||
- },
|
||||
- err => From::from(err)
|
||||
- }
|
||||
- })
|
||||
+ Ok(gb.build()?)
|
||||
}
|
||||
|
||||
/// Builds the set of glob overrides from the command line flags.
|
||||
diff --git a/tests/tests.rs b/tests/tests.rs
|
||||
index 8cb871843851..855f2484ddd3 100644
|
||||
--- a/tests/tests.rs
|
||||
+++ b/tests/tests.rs
|
||||
@@ -1687,16 +1687,6 @@ sherlock!(feature_419_zero_as_shortcut_for_null, "Sherlock", ".",
|
||||
assert_eq!(lines, "sherlock\x002\n");
|
||||
});
|
||||
|
||||
-// See: https://github.com/BurntSushi/ripgrep/issues/709
|
||||
-clean!(suggest_fixed_strings_for_invalid_regex, "foo(", ".",
|
||||
-|wd: WorkDir, mut cmd: Command| {
|
||||
- wd.assert_non_empty_stderr(&mut cmd);
|
||||
-
|
||||
- let output = cmd.output().unwrap();
|
||||
- let err = String::from_utf8_lossy(&output.stderr);
|
||||
- assert_eq!(err.contains("--fixed-strings"), true);
|
||||
-});
|
||||
-
|
||||
#[test]
|
||||
fn compressed_gzip() {
|
||||
if !cmd_exists("gzip") {
|
||||
--
|
||||
2.14.3
|
||||
|
@ -1,47 +0,0 @@
|
||||
From e4f995b59622a66bc6f02274f0db09634603dc17 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||
Date: Sun, 29 Jul 2018 20:12:43 +0200
|
||||
Subject: [PATCH 1/3] ignore: only respect .gitignore in git repos
|
||||
|
||||
This commit fixes an interesting bug in the `ignore` crate where it
|
||||
would basically respect any `.gitignore` file anywhere (including global
|
||||
gitignores in `~/.config/git/ignore`), regardless of whether we were
|
||||
searching in a git repository or not. This commit rectifies that
|
||||
behavior to only respect gitignore rules when in a git repo.
|
||||
|
||||
The key change here is to move the logic of whether to traverse parents
|
||||
into the directory matcher rather than putting the onus on the directory
|
||||
traverser. In particular, we now need to traverse parent directories in
|
||||
more cases than we previously did, since we need to determine whether
|
||||
we're in a git repository or not.
|
||||
|
||||
Fixes #934
|
||||
|
||||
(cherry picked from commit e65ca21a6cebceb9ba79fcd164da24478cc01fb0)
|
||||
---
|
||||
tests/tests.rs | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/tests/tests.rs b/tests/tests.rs
|
||||
index 34bf08e..903c470 100644
|
||||
--- a/tests/tests.rs
|
||||
+++ b/tests/tests.rs
|
||||
@@ -662,6 +662,7 @@ sherlock!(no_parent_ignore_git, "Sherlock", ".",
|
||||
|wd: WorkDir, mut cmd: Command| {
|
||||
// Set up a directory hierarchy like this:
|
||||
//
|
||||
+ // .git/
|
||||
// .gitignore
|
||||
// foo/
|
||||
// .gitignore
|
||||
@@ -679,6 +680,7 @@ sherlock!(no_parent_ignore_git, "Sherlock", ".",
|
||||
// In other words, we should only see results from `sherlock`, not from
|
||||
// `watson`.
|
||||
wd.remove("sherlock");
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "sherlock\n");
|
||||
wd.create_dir("foo");
|
||||
wd.create("foo/.gitignore", "watson\n");
|
||||
--
|
||||
2.18.0
|
||||
|
@ -1,68 +0,0 @@
|
||||
From f4c5480c1d6230f9267c7ef435f81656f8e9c900 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Gallant <jamslam@gmail.com>
|
||||
Date: Sun, 29 Jul 2018 09:40:38 -0400
|
||||
Subject: [PATCH 2/3] tests/style: 80 columns, dammit
|
||||
|
||||
(cherry picked from commit 7c412bb2fa343a8d54090ea175c851cd822d8f62)
|
||||
---
|
||||
tests/workdir.rs | 23 +++++++++++++++++++----
|
||||
1 file changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/workdir.rs b/tests/workdir.rs
|
||||
index 3c47e94..a78f70d 100644
|
||||
--- a/tests/workdir.rs
|
||||
+++ b/tests/workdir.rs
|
||||
@@ -49,7 +49,11 @@ impl WorkDir {
|
||||
|
||||
/// Try to create a new file with the given name and contents in this
|
||||
/// directory.
|
||||
- pub fn try_create<P: AsRef<Path>>(&self, name: P, contents: &str) -> io::Result<()> {
|
||||
+ pub fn try_create<P: AsRef<Path>>(
|
||||
+ &self,
|
||||
+ name: P,
|
||||
+ contents: &str,
|
||||
+ ) -> io::Result<()> {
|
||||
let path = self.dir.join(name);
|
||||
self.try_create_bytes(path, contents.as_bytes())
|
||||
}
|
||||
@@ -70,7 +74,11 @@ impl WorkDir {
|
||||
|
||||
/// Try to create a new file with the given name and contents in this
|
||||
/// directory.
|
||||
- fn try_create_bytes<P: AsRef<Path>>(&self, path: P, contents: &[u8]) -> io::Result<()> {
|
||||
+ fn try_create_bytes<P: AsRef<Path>>(
|
||||
+ &self,
|
||||
+ path: P,
|
||||
+ contents: &[u8],
|
||||
+ ) -> io::Result<()> {
|
||||
let mut file = File::create(&path)?;
|
||||
file.write_all(contents)?;
|
||||
file.flush()
|
||||
@@ -190,7 +198,11 @@ impl WorkDir {
|
||||
match stdout.parse() {
|
||||
Ok(t) => t,
|
||||
Err(err) => {
|
||||
- panic!("could not convert from string: {:?}\n\n{}", err, stdout);
|
||||
+ panic!(
|
||||
+ "could not convert from string: {:?}\n\n{}",
|
||||
+ err,
|
||||
+ stdout
|
||||
+ );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,7 +233,10 @@ impl WorkDir {
|
||||
write!(stdin, "{}", input)
|
||||
});
|
||||
|
||||
- let output = self.expect_success(cmd, child.wait_with_output().unwrap());
|
||||
+ let output = self.expect_success(
|
||||
+ cmd,
|
||||
+ child.wait_with_output().unwrap(),
|
||||
+ );
|
||||
worker.join().unwrap().unwrap();
|
||||
output
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
@ -1,177 +0,0 @@
|
||||
From dd556db0ec912d7cc90204deb78835f66cb0ae3b Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Gallant <jamslam@gmail.com>
|
||||
Date: Sun, 29 Jul 2018 10:15:20 -0400
|
||||
Subject: [PATCH 3/3] tests: reduce reliance on state in tests
|
||||
|
||||
This commit improves the integration test setup by running tests inside
|
||||
the system's temporary directory instead of within ripgrep's `target`
|
||||
directory. The motivation here is to attempt to reduce the effect of
|
||||
unanticipated state on ripgrep's integration tests, such as the presence
|
||||
of `.gitignore` files in ripgrep's checkout directory hierarchy
|
||||
(including parent directories).
|
||||
|
||||
This doesn't remove all possible state. For example, there's no
|
||||
guarantee that the system's temporary directory isn't itself within a
|
||||
git repository. Moreover, there may still be other ignore rules in the
|
||||
directory tree that might impact test behavior. Fixing this seems
|
||||
somewhat difficult. Conceptually, it seems like ripgrep should run each
|
||||
test in its own `chroot`-like environment, but doing this in a
|
||||
non-annoying and portable way (including Windows) doesn't appear to be
|
||||
possible.
|
||||
|
||||
Another approach to take here might be to teach ripgrep itself that a
|
||||
particular directory should be treated as root, and therefore, never
|
||||
look at anything outside that directory. This also seems complex to
|
||||
implement, but tractable. Let's see how this approach works for now.
|
||||
|
||||
Fixes #448, #996
|
||||
|
||||
(cherry picked from commit 2913fc4cd063f4d869f54497a313aafbf5330346)
|
||||
---
|
||||
tests/tests.rs | 9 +++++++++
|
||||
tests/workdir.rs | 36 +++++++++++++-----------------------
|
||||
2 files changed, 22 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/tests/tests.rs b/tests/tests.rs
|
||||
index 903c470..9080aaf 100644
|
||||
--- a/tests/tests.rs
|
||||
+++ b/tests/tests.rs
|
||||
@@ -575,6 +575,7 @@ sherlock!(no_ignore_hidden, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
});
|
||||
|
||||
sherlock!(ignore_git, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "sherlock\n");
|
||||
wd.assert_err(&mut cmd);
|
||||
});
|
||||
@@ -776,6 +777,7 @@ sherlock:5:12:but Doctor Watson has to have it taken out for him and dusted,
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/16
|
||||
clean!(regression_16, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "ghi/");
|
||||
wd.create_dir("ghi");
|
||||
wd.create_dir("def/ghi");
|
||||
@@ -835,6 +837,7 @@ clean!(regression_50, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/65
|
||||
clean!(regression_65, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "a/");
|
||||
wd.create_dir("a");
|
||||
wd.create("a/foo", "xyz");
|
||||
@@ -844,6 +847,7 @@ clean!(regression_65, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/67
|
||||
clean!(regression_67, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "/*\n!/dir");
|
||||
wd.create_dir("dir");
|
||||
wd.create_dir("foo");
|
||||
@@ -856,6 +860,7 @@ clean!(regression_67, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/87
|
||||
clean!(regression_87, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "foo\n**no-vcs**");
|
||||
wd.create("foo", "test");
|
||||
wd.assert_err(&mut cmd);
|
||||
@@ -863,6 +868,7 @@ clean!(regression_87, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/90
|
||||
clean!(regression_90, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "!.foo");
|
||||
wd.create(".foo", "test");
|
||||
|
||||
@@ -923,6 +929,7 @@ clean!(regression_127, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
// ripgrep should ignore 'foo/sherlock' giving us results only from
|
||||
// 'foo/watson' but on Windows ripgrep will include both 'foo/sherlock' and
|
||||
// 'foo/watson' in the search results.
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "foo/sherlock\n");
|
||||
wd.create_dir("foo");
|
||||
wd.create("foo/sherlock", hay::SHERLOCK);
|
||||
@@ -950,6 +957,7 @@ clean!(regression_128, "x", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
// TODO(burntsushi): Darwin doesn't like this test for some reason.
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
clean!(regression_131, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", "TopÑapa");
|
||||
wd.create("TopÑapa", "test");
|
||||
wd.assert_err(&mut cmd);
|
||||
@@ -1237,6 +1245,7 @@ clean!(regression_599, "^$", "input.txt", |wd: WorkDir, mut cmd: Command| {
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/807
|
||||
clean!(regression_807, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
+ wd.create_dir(".git");
|
||||
wd.create(".gitignore", ".a/b");
|
||||
wd.create_dir(".a/b");
|
||||
wd.create_dir(".a/c");
|
||||
diff --git a/tests/workdir.rs b/tests/workdir.rs
|
||||
index a78f70d..9736a64 100644
|
||||
--- a/tests/workdir.rs
|
||||
+++ b/tests/workdir.rs
|
||||
@@ -21,7 +21,8 @@ pub struct WorkDir {
|
||||
/// The directory in which this test executable is running.
|
||||
root: PathBuf,
|
||||
/// The directory in which the test should run. If a test needs to create
|
||||
- /// files, they should go in here.
|
||||
+ /// files, they should go in here. This directory is also used as the CWD
|
||||
+ /// for any processes created by the test.
|
||||
dir: PathBuf,
|
||||
}
|
||||
|
||||
@@ -31,9 +32,15 @@ impl WorkDir {
|
||||
/// to a logical grouping of tests.
|
||||
pub fn new(name: &str) -> WorkDir {
|
||||
let id = NEXT_ID.fetch_add(1, Ordering::SeqCst);
|
||||
- let root = env::current_exe().unwrap()
|
||||
- .parent().expect("executable's directory").to_path_buf();
|
||||
- let dir = root.join(TEST_DIR).join(name).join(&format!("{}", id));
|
||||
+ let root = env::current_exe()
|
||||
+ .unwrap()
|
||||
+ .parent()
|
||||
+ .expect("executable's directory")
|
||||
+ .to_path_buf();
|
||||
+ let dir = env::temp_dir()
|
||||
+ .join(TEST_DIR)
|
||||
+ .join(name)
|
||||
+ .join(&format!("{}", id));
|
||||
nice_err(&dir, repeat(|| fs::create_dir_all(&dir)));
|
||||
WorkDir {
|
||||
root: root,
|
||||
@@ -107,28 +114,11 @@ impl WorkDir {
|
||||
}
|
||||
|
||||
/// Returns the path to the ripgrep executable.
|
||||
- #[cfg(not(windows))]
|
||||
- pub fn bin(&self) -> PathBuf {
|
||||
- let path = self.root.join("rg");
|
||||
- if !path.is_file() {
|
||||
- // Looks like a recent version of Cargo changed the cwd or the
|
||||
- // location of the test executable.
|
||||
- self.root.join("../rg")
|
||||
- } else {
|
||||
- path
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /// Returns the path to the ripgrep executable.
|
||||
- #[cfg(windows)]
|
||||
pub fn bin(&self) -> PathBuf {
|
||||
- let path = self.root.join("rg.exe");
|
||||
- if !path.is_file() {
|
||||
- // Looks like a recent version of Cargo changed the cwd or the
|
||||
- // location of the test executable.
|
||||
+ if cfg!(windows) {
|
||||
self.root.join("../rg.exe")
|
||||
} else {
|
||||
- path
|
||||
+ self.root.join("../rg")
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.18.0
|
||||
|
@ -1,44 +0,0 @@
|
||||
--- ripgrep-0.8.1/Cargo.toml 1970-01-01T01:00:00+01:00
|
||||
+++ ripgrep-0.8.1/Cargo.toml 2018-07-29T09:01:13.884232+02:00
|
||||
@@ -47,10 +47,10 @@
|
||||
default-features = false
|
||||
|
||||
[dependencies.encoding_rs]
|
||||
-version = "0.7"
|
||||
+version = "0.8"
|
||||
|
||||
[dependencies.globset]
|
||||
-version = "0.3.0"
|
||||
+version = "0.4"
|
||||
|
||||
[dependencies.grep]
|
||||
version = "0.1.8"
|
||||
@@ -77,13 +77,13 @@
|
||||
version = "1"
|
||||
|
||||
[dependencies.regex]
|
||||
-version = "0.2.4"
|
||||
+version = "1"
|
||||
|
||||
[dependencies.same-file]
|
||||
version = "1"
|
||||
|
||||
[dependencies.termcolor]
|
||||
-version = "0.3.4"
|
||||
+version = "1"
|
||||
[build-dependencies.clap]
|
||||
version = "2.29.4"
|
||||
features = ["suggestions", "color"]
|
||||
@@ -92,12 +92,6 @@
|
||||
[build-dependencies.lazy_static]
|
||||
version = "1"
|
||||
|
||||
-[features]
|
||||
-avx-accel = ["bytecount/avx-accel"]
|
||||
-simd-accel = ["bytecount/simd-accel", "regex/simd-accel", "encoding_rs/simd-accel"]
|
||||
-[target."cfg(windows)".dependencies.winapi]
|
||||
-version = "0.3"
|
||||
-features = ["std", "winnt"]
|
||||
[badges.appveyor]
|
||||
repository = "BurntSushi/ripgrep"
|
||||
|
@ -0,0 +1,12 @@
|
||||
--- ripgrep-0.9.0/Cargo.toml 1970-01-01T01:00:00+01:00
|
||||
+++ ripgrep-0.9.0/Cargo.toml 2018-08-04T15:43:31.831949+02:00
|
||||
@@ -99,9 +99,6 @@
|
||||
[features]
|
||||
avx-accel = ["bytecount/avx-accel"]
|
||||
simd-accel = ["bytecount/simd-accel", "encoding_rs/simd-accel"]
|
||||
-[target."cfg(windows)".dependencies.winapi]
|
||||
-version = "0.3"
|
||||
-features = ["std", "winnt"]
|
||||
[badges.appveyor]
|
||||
repository = "BurntSushi/ripgrep"
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (ripgrep-0.8.1.crate) = bd1575d0b2efc9799ad00bf931fee61e5a475db9725c9587f9f157e0dcb6c958defb09ffa4636965806481a09e3d3218b820f601d931bf5a9b8bcde92956d9bb
|
||||
SHA512 (ripgrep-0.9.0.crate) = 8adab0f95421e853b813d74d6c45cfbcf6fe9485f445fc79e34fe53ac59f81dce727d1551a2a99effdf8b7c479681927c1dbeba86bce55dab8353e8a7e0db60b
|
||||
|
Loading…
Reference in new issue