mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-26 09:42:00 -07:00
Compare commits
77 Commits
grep-cli-0
...
grep-0.2.1
Author | SHA1 | Date | |
---|---|---|---|
|
7efa2e46d3 | ||
|
db0b92b62d | ||
|
33b81cac48 | ||
|
6a13a4f64d | ||
|
b13d835d95 | ||
|
d53506b7f7 | ||
|
78a35d4d43 | ||
|
a933d0bc90 | ||
|
2cae30e399 | ||
|
8e57989cd2 | ||
|
b9f5835534 | ||
|
e70778e89d | ||
|
87c4a2b4b1 | ||
|
0aa31676e3 | ||
|
9f0e88bcb1 | ||
|
eb4b389846 | ||
|
dc337bab0a | ||
|
2cfb338530 | ||
|
48646e3451 | ||
|
985394a19e | ||
|
ec36f8c3ff | ||
|
a726d03641 | ||
|
91afd4214a | ||
|
4dc6c73c5a | ||
|
36d03b4101 | ||
|
d161acb0a3 | ||
|
30ee6f08ee | ||
|
ced5b92aa9 | ||
|
191315a2ea | ||
|
5370064f00 | ||
|
b6189c659e | ||
|
0b36942f68 | ||
|
7e05cde008 | ||
|
418d048b27 | ||
|
009dda1488 | ||
|
ba535fb5a3 | ||
|
427aaeeb2e | ||
|
f5cff746bc | ||
|
457f53b7ee | ||
|
eb35f7978e | ||
|
fc69bd366c | ||
|
9b01a8f9ae | ||
|
0ff5dd2360 | ||
|
3c7819301b | ||
|
699e651db2 | ||
|
9eddb71b8e | ||
|
abf115228e | ||
|
fdfc418be5 | ||
|
5bf74362b9 | ||
|
431ea38620 | ||
|
caba5c4348 | ||
|
07f97d42cf | ||
|
e33d6e73f5 | ||
|
478da4f271 | ||
|
7ce66f73cf | ||
|
bc76a30c23 | ||
|
5e81c60b35 | ||
|
b3e5ae9d28 | ||
|
a024f14fdd | ||
|
8c30c8294a | ||
|
c44d263419 | ||
|
af6b6c543b | ||
|
1a4fec8b4a | ||
|
c8d8ab8ded | ||
|
1d53ed2744 | ||
|
29696d1455 | ||
|
57ce623a57 | ||
|
f1c656de40 | ||
|
dd47582619 | ||
|
9b88cf8b72 | ||
|
6668d7ba8a | ||
|
008da5dca4 | ||
|
a34df1f690 | ||
|
7f3fd6f7ce | ||
|
6331a7ac18 | ||
|
cd4386bd9b | ||
|
cdc20c5685 |
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -98,11 +98,9 @@ jobs:
|
||||
ci/macos-install-packages
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Use Cross
|
||||
if: matrix.target != ''
|
||||
@@ -185,11 +183,9 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
profile: minimal
|
||||
components: rustfmt
|
||||
- name: Check formatting
|
||||
run: |
|
||||
@@ -202,11 +198,9 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: Check documentation
|
||||
env:
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -112,11 +112,9 @@ jobs:
|
||||
ci/macos-install-packages
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Use Cross
|
||||
|
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,9 +1,25 @@
|
||||
TBD
|
||||
===
|
||||
Unreleased changes. Release notes have not yet been written.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* [BUG #1891](https://github.com/BurntSushi/ripgrep/issues/1891):
|
||||
Fix bug when using `-w` with a regex that can match the empty string.
|
||||
* [BUG #1911](https://github.com/BurntSushi/ripgrep/issues/1911):
|
||||
Disable mmap searching in all non-64-bit environments.
|
||||
* [BUG #2236](https://github.com/BurntSushi/ripgrep/issues/2236):
|
||||
Fix gitignore parsing bug where a trailing `\/` resulted in an error.
|
||||
|
||||
|
||||
13.0.0 (2021-06-12)
|
||||
===================
|
||||
ripgrep 13 is a new major version release of ripgrep that primarily contains
|
||||
bug fixes. There is also a fix for a security vulnerability on Windows
|
||||
([CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013)),
|
||||
some performance improvements and some minor breaking changes.
|
||||
bug fixes, some performance improvements and a few minor breaking changes.
|
||||
There is also a fix for a security vulnerability on Windows
|
||||
([CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013)).
|
||||
|
||||
Some highlights:
|
||||
|
||||
A new short flag, `-.`, has been added. It is an alias for the `--hidden` flag,
|
||||
which instructs ripgrep to search hidden files and directories.
|
||||
|
144
Cargo.lock
generated
144
Cargo.lock
generated
@@ -30,15 +30,15 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
@@ -53,19 +53,13 @@ checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.68"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
@@ -74,9 +68,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"strsim",
|
||||
@@ -86,31 +80,31 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.1"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
|
||||
checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.5"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
|
||||
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.28"
|
||||
version = "0.8.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065"
|
||||
checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"packed_simd_2",
|
||||
]
|
||||
|
||||
@@ -143,7 +137,7 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.7"
|
||||
version = "0.4.9"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -158,7 +152,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep"
|
||||
version = "0.2.7"
|
||||
version = "0.2.10"
|
||||
dependencies = [
|
||||
"grep-cli",
|
||||
"grep-matcher",
|
||||
@@ -187,7 +181,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-matcher"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"regex",
|
||||
@@ -195,7 +189,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"grep-matcher",
|
||||
"pcre2",
|
||||
@@ -203,7 +197,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-printer"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bstr",
|
||||
@@ -217,7 +211,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-regex"
|
||||
version = "0.1.8"
|
||||
version = "0.1.10"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
@@ -230,7 +224,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.7"
|
||||
version = "0.1.10"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"bytecount",
|
||||
@@ -245,9 +239,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.18"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -271,9 +265,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-sys"
|
||||
@@ -298,9 +292,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.22"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||
checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -313,9 +307,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.97"
|
||||
version = "0.2.121"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6"
|
||||
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
@@ -329,29 +323,29 @@ version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.3.0"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20ff203f7bdc401350b1dbaa0355135777d25f41c0bbc601851bbd6cf61e8ff5"
|
||||
checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
|
||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
@@ -359,17 +353,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.7.2"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "packed_simd_2"
|
||||
version = "0.3.5"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e64858a2d3733fdd61adfdd6da89aa202f7ff0e741d2fc7ed1e452ba9dc99d7"
|
||||
checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if",
|
||||
"libm",
|
||||
]
|
||||
|
||||
@@ -398,33 +392,33 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
version = "1.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -445,7 +439,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "ripgrep"
|
||||
version = "12.1.1"
|
||||
version = "13.0.0"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"clap",
|
||||
@@ -465,9 +459,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
@@ -480,18 +474,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.126"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.126"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -500,9 +494,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -517,9 +511,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.73"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
|
||||
checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -528,9 +522,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
@@ -546,18 +540,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ripgrep"
|
||||
version = "12.1.1" #:version
|
||||
version = "13.0.0" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
ripgrep is a line-oriented search tool that recursively searches the current
|
||||
@@ -42,7 +42,7 @@ members = [
|
||||
|
||||
[dependencies]
|
||||
bstr = "0.2.12"
|
||||
grep = { version = "0.2.7", path = "crates/grep" }
|
||||
grep = { version = "0.2.8", path = "crates/grep" }
|
||||
ignore = { version = "0.4.18", path = "crates/ignore" }
|
||||
lazy_static = "1.1.0"
|
||||
log = "0.4.5"
|
||||
|
18
GUIDE.md
18
GUIDE.md
@@ -178,11 +178,11 @@ search. By default, when you search a directory, ripgrep will ignore all of
|
||||
the following:
|
||||
|
||||
1. Files and directories that match glob patterns in these three categories:
|
||||
1. gitignore globs (including global and repo-specific globs).
|
||||
2. `.ignore` globs, which take precedence over all gitignore globs when
|
||||
there's a conflict.
|
||||
3. `.rgignore` globs, which take precedence over all `.ignore` globs when
|
||||
there's a conflict.
|
||||
1. gitignore globs (including global and repo-specific globs).
|
||||
2. `.ignore` globs, which take precedence over all gitignore globs
|
||||
when there's a conflict.
|
||||
3. `.rgignore` globs, which take precedence over all `.ignore` globs
|
||||
when there's a conflict.
|
||||
2. Hidden files and directories.
|
||||
3. Binary files. (ripgrep considers any file with a `NUL` byte to be binary.)
|
||||
4. Symbolic links aren't followed.
|
||||
@@ -648,9 +648,9 @@ given, which is the default:
|
||||
they correspond to a UTF-16 BOM, then ripgrep will transcode the contents of
|
||||
the file from UTF-16 to UTF-8, and then execute the search on the transcoded
|
||||
version of the file. (This incurs a performance penalty since transcoding
|
||||
is slower than regex searching.) If the file contains invalid UTF-16, then
|
||||
the Unicode replacement codepoint is substituted in place of invalid code
|
||||
units.
|
||||
is needed in addition to regex searching.) If the file contains invalid
|
||||
UTF-16, then the Unicode replacement codepoint is substituted in place of
|
||||
invalid code units.
|
||||
* To handle other cases, ripgrep provides a `-E/--encoding` flag, which permits
|
||||
you to specify an encoding from the
|
||||
[Encoding Standard](https://encoding.spec.whatwg.org/#concept-encoding-get).
|
||||
@@ -992,6 +992,8 @@ used options that will likely impact how you use ripgrep on a regular basis.
|
||||
* `-S/--smart-case`: This is similar to `--ignore-case`, but disables itself
|
||||
if the pattern contains any uppercase letters. Usually this flag is put into
|
||||
alias or a config file.
|
||||
* `-F/--fixed-strings`: Disable regular expression matching and treat the pattern
|
||||
as a literal string.
|
||||
* `-w/--word-regexp`: Require that all matches of the pattern be surrounded
|
||||
by word boundaries. That is, given `pattern`, the `--word-regexp` flag will
|
||||
cause ripgrep to behave as if `pattern` were actually `\b(?:pattern)\b`.
|
||||
|
@@ -272,8 +272,8 @@ then ripgrep can be installed using a binary `.deb` file provided in each
|
||||
[ripgrep release](https://github.com/BurntSushi/ripgrep/releases).
|
||||
|
||||
```
|
||||
$ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep_12.1.1_amd64.deb
|
||||
$ sudo dpkg -i ripgrep_12.1.1_amd64.deb
|
||||
$ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep_13.0.0_amd64.deb
|
||||
$ sudo dpkg -i ripgrep_13.0.0_amd64.deb
|
||||
```
|
||||
|
||||
If you run Debian Buster (currently Debian stable) or Debian sid, ripgrep is
|
||||
|
@@ -26,6 +26,11 @@ Release Checklist
|
||||
`cargo update -p ripgrep` so that the `Cargo.lock` is updated. Commit the
|
||||
changes and create a new signed tag. Alternatively, use
|
||||
`cargo-up --no-push --no-release Cargo.toml {VERSION}` to automate this.
|
||||
* Push changes to GitHub, NOT including the tag. (But do not publish new
|
||||
version of ripgrep to crates.io yet.)
|
||||
* Once CI for `master` finishes successfully, push the version tag. (Trying to
|
||||
do this in one step seems to result in GitHub Actions not seeing the tag
|
||||
push and thus not running the release workflow.)
|
||||
* Wait for CI to finish creating the release. If the release build fails, then
|
||||
delete the tag from GitHub, make fixes, re-tag, delete the release and push.
|
||||
* Copy the relevant section of the CHANGELOG to the tagged release notes.
|
||||
|
@@ -39,4 +39,4 @@ 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.
|
||||
PCRE2_SYS_STATIC=1 cargo deb
|
||||
PCRE2_SYS_STATIC=1 cargo deb --target x86_64-unknown-linux-musl
|
||||
|
@@ -1,6 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script gets run in weird environments that have been stripped of just
|
||||
# about every inessential thing. In order to keep this script versatile, we
|
||||
# just install 'sudo' and use it like normal if it doesn't exist. If it doesn't
|
||||
# exist, we assume we're root. (Otherwise we ain't doing much of anything
|
||||
# anyway.)
|
||||
if ! command -V sudo; then
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends sudo
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
asciidoctor \
|
||||
zsh xz-utils liblz4-tool musl-tools
|
||||
zsh xz-utils liblz4-tool musl-tools \
|
||||
brotli zstd
|
||||
|
@@ -10,13 +10,13 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/cli"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/cli"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "grep", "cli", "utility", "util"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
atty = "0.2.11"
|
||||
bstr = "0.2.0"
|
||||
globset = { version = "0.4.7", path = "../globset" }
|
||||
globset = { version = "0.4.9", path = "../globset" }
|
||||
lazy_static = "1.1.0"
|
||||
log = "0.4.5"
|
||||
regex = "1.1"
|
||||
|
@@ -382,7 +382,7 @@ impl DecompressionReader {
|
||||
///
|
||||
/// `close` is also called in `drop` as a last line of defense against
|
||||
/// resource leakage. Any error from the child process is then printed as a
|
||||
/// warning to stderr. This can be avoided by explictly calling `close`
|
||||
/// warning to stderr. This can be avoided by explicitly calling `close`
|
||||
/// before the CommandReader is dropped.
|
||||
pub fn close(&mut self) -> io::Result<()> {
|
||||
match self.rdr {
|
||||
|
@@ -8,7 +8,7 @@ use regex::Regex;
|
||||
/// An error that occurs when parsing a human readable size description.
|
||||
///
|
||||
/// This error provides an end user friendly message describing why the
|
||||
/// description coudln't be parsed and what the expected format is.
|
||||
/// description couldn't be parsed and what the expected format is.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ParseSizeError {
|
||||
original: String,
|
||||
|
@@ -212,13 +212,13 @@ pub fn is_readable_stdin() -> bool {
|
||||
!is_tty_stdin() && imp()
|
||||
}
|
||||
|
||||
/// Returns true if and only if stdin is believed to be connectted to a tty
|
||||
/// Returns true if and only if stdin is believed to be connected to a tty
|
||||
/// or a console.
|
||||
pub fn is_tty_stdin() -> bool {
|
||||
atty::is(atty::Stream::Stdin)
|
||||
}
|
||||
|
||||
/// Returns true if and only if stdout is believed to be connectted to a tty
|
||||
/// Returns true if and only if stdout is believed to be connected to a tty
|
||||
/// or a console.
|
||||
///
|
||||
/// This is useful for when you want your command line program to produce
|
||||
@@ -230,7 +230,7 @@ pub fn is_tty_stdout() -> bool {
|
||||
atty::is(atty::Stream::Stdout)
|
||||
}
|
||||
|
||||
/// Returns true if and only if stderr is believed to be connectted to a tty
|
||||
/// Returns true if and only if stderr is believed to be connected to a tty
|
||||
/// or a console.
|
||||
pub fn is_tty_stderr() -> bool {
|
||||
atty::is(atty::Stream::Stderr)
|
||||
|
@@ -221,7 +221,7 @@ impl CommandReader {
|
||||
///
|
||||
/// `close` is also called in `drop` as a last line of defense against
|
||||
/// resource leakage. Any error from the child process is then printed as a
|
||||
/// warning to stderr. This can be avoided by explictly calling `close`
|
||||
/// warning to stderr. This can be avoided by explicitly calling `close`
|
||||
/// before the CommandReader is dropped.
|
||||
pub fn close(&mut self) -> io::Result<()> {
|
||||
// Dropping stdout closes the underlying file descriptor, which should
|
||||
|
@@ -1242,7 +1242,7 @@ fn flag_field_context_separator(args: &mut Vec<RGArg>) {
|
||||
Set the field context separator, which is used to delimit file paths, line
|
||||
numbers, columns and the context itself, when printing contextual lines. The
|
||||
separator may be any number of bytes, including zero. Escape sequences like
|
||||
\\x7F or \\t may be used. The default value is -.
|
||||
\\x7F or \\t may be used. The '-' character is the default value.
|
||||
"
|
||||
);
|
||||
let arg = RGArg::flag("field-context-separator", "SEPARATOR")
|
||||
@@ -1257,8 +1257,8 @@ fn flag_field_match_separator(args: &mut Vec<RGArg>) {
|
||||
"\
|
||||
Set the field match separator, which is used to delimit file paths, line
|
||||
numbers, columns and the match itself. The separator may be any number of
|
||||
bytes, including zero. Escape sequences like \\x7F or \\t may be used. The
|
||||
default value is -.
|
||||
bytes, including zero. Escape sequences like \\x7F or \\t may be used. The ':'
|
||||
character is the default value.
|
||||
"
|
||||
);
|
||||
let arg = RGArg::flag("field-match-separator", "SEPARATOR")
|
||||
@@ -1395,7 +1395,7 @@ it. If multiple globs match a file or directory, the glob given later in the
|
||||
command line takes precedence.
|
||||
|
||||
As an extension, globs support specifying alternatives: *-g ab{c,d}* is
|
||||
equivalet to *-g abc -g abd*. Empty alternatives like *-g ab{,c}* are not
|
||||
equivalent to *-g abc -g abd*. Empty alternatives like *-g ab{,c}* are not
|
||||
currently supported. Note that this syntax extension is also currently enabled
|
||||
in gitignore files, even though this syntax isn't supported by git itself.
|
||||
ripgrep may disable this syntax extension in gitignore files, but it will
|
||||
@@ -1548,7 +1548,7 @@ When specifying multiple ignore files, earlier files have lower precedence
|
||||
than later files.
|
||||
|
||||
If you are looking for a way to include or exclude files and directories
|
||||
directly on the command line, then used -g instead.
|
||||
directly on the command line, then use -g instead.
|
||||
"
|
||||
);
|
||||
let arg = RGArg::flag("ignore-file", "PATH")
|
||||
|
@@ -104,7 +104,7 @@ struct ArgsImp {
|
||||
///
|
||||
/// It's important that this is only built once, since building this goes
|
||||
/// through regex compilation and various types of analyses. That is, if
|
||||
/// you need many of theses (one per thread, for example), it is better to
|
||||
/// you need many of these (one per thread, for example), it is better to
|
||||
/// build it once and then clone it.
|
||||
matcher: PatternMatcher,
|
||||
/// The paths provided at the command line. This is guaranteed to be
|
||||
|
@@ -28,7 +28,10 @@ pub fn args() -> Vec<OsString> {
|
||||
let (args, errs) = match parse(&config_path) {
|
||||
Ok((args, errs)) => (args, errs),
|
||||
Err(err) => {
|
||||
message!("{}", err);
|
||||
message!(
|
||||
"failed to read the file specified in RIPGREP_CONFIG_PATH: {}",
|
||||
err
|
||||
);
|
||||
return vec![];
|
||||
}
|
||||
};
|
||||
|
@@ -67,7 +67,7 @@ impl SubjectBuilder {
|
||||
if subj.is_file() {
|
||||
return Some(subj);
|
||||
}
|
||||
// We got nothin. Emit a debug message, but only if this isn't a
|
||||
// We got nothing. Emit a debug message, but only if this isn't a
|
||||
// directory. Otherwise, emitting messages for directories is just
|
||||
// noisy.
|
||||
if !subj.is_dir() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "globset"
|
||||
version = "0.4.7" #:version
|
||||
version = "0.4.9" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Cross platform single glob and glob set matching. Glob set matching is the
|
||||
@@ -12,7 +12,7 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/globset"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/globset"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "glob", "multiple", "set", "pattern"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
@@ -23,7 +23,7 @@ bench = false
|
||||
aho-corasick = "0.7.3"
|
||||
bstr = { version = "0.2.0", default-features = false, features = ["std"] }
|
||||
fnv = "1.0.6"
|
||||
log = "0.4.5"
|
||||
log = { version = "0.4.5", optional = true }
|
||||
regex = { version = "1.1.5", default-features = false, features = ["perf", "std"] }
|
||||
serde = { version = "1.0.104", optional = true }
|
||||
|
||||
@@ -33,5 +33,6 @@ lazy_static = "1"
|
||||
serde_json = "1.0.45"
|
||||
|
||||
[features]
|
||||
default = ["log"]
|
||||
simd-accel = []
|
||||
serde1 = ["serde"]
|
||||
|
@@ -19,7 +19,7 @@ Add this to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
globset = "0.3"
|
||||
globset = "0.4"
|
||||
```
|
||||
|
||||
### Features
|
||||
@@ -78,12 +78,12 @@ assert_eq!(set.matches("src/bar/baz/foo.rs"), vec![0, 2]);
|
||||
|
||||
This crate implements globs by converting them to regular expressions, and
|
||||
executing them with the
|
||||
[`regex`](https://github.com/rust-lang-nursery/regex)
|
||||
[`regex`](https://github.com/rust-lang/regex)
|
||||
crate.
|
||||
|
||||
For single glob matching, performance of this crate should be roughly on par
|
||||
with the performance of the
|
||||
[`glob`](https://github.com/rust-lang-nursery/glob)
|
||||
[`glob`](https://github.com/rust-lang/glob)
|
||||
crate. (`*_regex` correspond to benchmarks for this library while `*_glob`
|
||||
correspond to benchmarks for the `glob` library.)
|
||||
Optimizations in the `regex` crate may propel this library past `glob`,
|
||||
@@ -108,7 +108,7 @@ test many_short_glob ... bench: 1,063 ns/iter (+/- 47)
|
||||
test many_short_regex_set ... bench: 186 ns/iter (+/- 11)
|
||||
```
|
||||
|
||||
### Comparison with the [`glob`](https://github.com/rust-lang-nursery/glob) crate
|
||||
### Comparison with the [`glob`](https://github.com/rust-lang/glob) crate
|
||||
|
||||
* Supports alternate "or" globs, e.g., `*.{foo,bar}`.
|
||||
* Can match non-UTF-8 file paths correctly.
|
||||
|
@@ -143,8 +143,6 @@ impl GlobMatcher {
|
||||
struct GlobStrategic {
|
||||
/// The match strategy to use.
|
||||
strategy: MatchStrategy,
|
||||
/// The underlying pattern.
|
||||
pat: Glob,
|
||||
/// The pattern, as a compiled regex.
|
||||
re: Regex,
|
||||
}
|
||||
@@ -273,7 +271,7 @@ impl Glob {
|
||||
let strategy = MatchStrategy::new(self);
|
||||
let re =
|
||||
new_regex(&self.re).expect("regex compilation shouldn't fail");
|
||||
GlobStrategic { strategy: strategy, pat: self.clone(), re: re }
|
||||
GlobStrategic { strategy: strategy, re: re }
|
||||
}
|
||||
|
||||
/// Returns the original glob pattern used to build this pattern.
|
||||
|
@@ -125,6 +125,16 @@ mod pathutil;
|
||||
#[cfg(feature = "serde1")]
|
||||
mod serde_impl;
|
||||
|
||||
#[cfg(feature = "log")]
|
||||
macro_rules! debug {
|
||||
($($token:tt)*) => (::log::debug!($($token)*);)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "log"))]
|
||||
macro_rules! debug {
|
||||
($($token:tt)*) => {};
|
||||
}
|
||||
|
||||
/// Represents an error that can occur when parsing a glob pattern.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Error {
|
||||
@@ -413,12 +423,12 @@ impl GlobSet {
|
||||
required_exts.add(i, ext, p.regex().to_owned());
|
||||
}
|
||||
MatchStrategy::Regex => {
|
||||
log::debug!("glob converted to regex: {:?}", p);
|
||||
debug!("glob converted to regex: {:?}", p);
|
||||
regexes.add(i, p.regex().to_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
log::debug!(
|
||||
debug!(
|
||||
"built glob set; {} literals, {} basenames, {} extensions, \
|
||||
{} prefixes, {} suffixes, {} required extensions, {} regexes",
|
||||
lits.0.len(),
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
use Glob;
|
||||
use crate::Glob;
|
||||
|
||||
impl Serialize for Glob {
|
||||
fn serialize<S: Serializer>(
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep"
|
||||
version = "0.2.7" #:version
|
||||
version = "0.2.10" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -10,16 +10,16 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
grep-cli = { version = "0.1.5", path = "../cli" }
|
||||
grep-matcher = { version = "0.1.4", path = "../matcher" }
|
||||
grep-pcre2 = { version = "0.1.4", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.1.5", path = "../printer" }
|
||||
grep-regex = { version = "0.1.8", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.7", path = "../searcher" }
|
||||
grep-cli = { version = "0.1.6", path = "../cli" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
grep-pcre2 = { version = "0.1.5", path = "../pcre2", optional = true }
|
||||
grep-printer = { version = "0.1.6", path = "../printer" }
|
||||
grep-regex = { version = "0.1.10", path = "../regex" }
|
||||
grep-searcher = { version = "0.1.10", path = "../searcher" }
|
||||
|
||||
[dev-dependencies]
|
||||
termcolor = "1.0.4"
|
||||
|
@@ -11,7 +11,7 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore"
|
||||
readme = "README.md"
|
||||
keywords = ["glob", "ignore", "gitignore", "pattern", "file"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
@@ -20,7 +20,7 @@ bench = false
|
||||
|
||||
[dependencies]
|
||||
crossbeam-utils = "0.8.0"
|
||||
globset = { version = "0.4.7", path = "../globset" }
|
||||
globset = { version = "0.4.9", path = "../globset" }
|
||||
lazy_static = "1.1"
|
||||
log = "0.4.5"
|
||||
memchr = "2.1"
|
||||
|
@@ -16,12 +16,16 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
("asciidoc", &["*.adoc", "*.asc", "*.asciidoc"]),
|
||||
("asm", &["*.asm", "*.s", "*.S"]),
|
||||
("asp", &[
|
||||
"*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs", "*.ascx.vb",
|
||||
"*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
|
||||
"*.ascx.vb", "*.asp"
|
||||
]),
|
||||
("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]),
|
||||
("avro", &["*.avdl", "*.avpr", "*.avsc"]),
|
||||
("awk", &["*.awk"]),
|
||||
("bazel", &["*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "WORKSPACE"]),
|
||||
("bazel", &[
|
||||
"*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
|
||||
"WORKSPACE", "WORKSPACE.bazel",
|
||||
]),
|
||||
("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
|
||||
("brotli", &["*.br"]),
|
||||
("buildstream", &["*.bst"]),
|
||||
@@ -40,18 +44,20 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
"*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
|
||||
]),
|
||||
("creole", &["*.creole"]),
|
||||
("crystal", &["Projectfile", "*.cr"]),
|
||||
("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
|
||||
("cs", &["*.cs"]),
|
||||
("csharp", &["*.cs"]),
|
||||
("cshtml", &["*.cshtml"]),
|
||||
("css", &["*.css", "*.scss"]),
|
||||
("csv", &["*.csv"]),
|
||||
("cuda", &["*.cu", "*.cuh"]),
|
||||
("cython", &["*.pyx", "*.pxi", "*.pxd"]),
|
||||
("d", &["*.d"]),
|
||||
("dart", &["*.dart"]),
|
||||
("dhall", &["*.dhall"]),
|
||||
("diff", &["*.patch", "*.diff"]),
|
||||
("docker", &["*Dockerfile*"]),
|
||||
("dts", &["*.dts", "*.dtsi"]),
|
||||
("dvc", &["Dvcfile", "*.dvc"]),
|
||||
("ebuild", &["*.ebuild"]),
|
||||
("edn", &["*.edn"]),
|
||||
@@ -60,6 +66,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
("elm", &["*.elm"]),
|
||||
("erb", &["*.erb"]),
|
||||
("erlang", &["*.erl", "*.hrl"]),
|
||||
("fennel", &["*.fnl"]),
|
||||
("fidl", &["*.fidl"]),
|
||||
("fish", &["*.fish"]),
|
||||
("flatbuffers", &["*.fbs"]),
|
||||
@@ -68,20 +75,23 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
"*.f90", "*.F90", "*.f95", "*.F95",
|
||||
]),
|
||||
("fsharp", &["*.fs", "*.fsx", "*.fsi"]),
|
||||
("fut", &[".fut"]),
|
||||
("fut", &["*.fut"]),
|
||||
("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
|
||||
("gn", &["*.gn", "*.gni"]),
|
||||
("go", &["*.go"]),
|
||||
("gradle", &["*.gradle"]),
|
||||
("groovy", &["*.groovy", "*.gradle"]),
|
||||
("gzip", &["*.gz", "*.tgz"]),
|
||||
("h", &["*.h", "*.hpp"]),
|
||||
("h", &["*.h", "*.hh", "*.hpp"]),
|
||||
("haml", &["*.haml"]),
|
||||
("hare", &["*.ha"]),
|
||||
("haskell", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
|
||||
("hbs", &["*.hbs"]),
|
||||
("hs", &["*.hs", "*.lhs"]),
|
||||
("html", &["*.htm", "*.html", "*.ejs"]),
|
||||
("hy", &["*.hy"]),
|
||||
("idris", &["*.idr", "*.lidr"]),
|
||||
("janet", &["*.janet"]),
|
||||
("java", &["*.java", "*.jsp", "*.jspx", "*.properties"]),
|
||||
("jinja", &["*.j2", "*.jinja", "*.jinja2"]),
|
||||
("jl", &["*.jl"]),
|
||||
@@ -120,6 +130,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
"MPL-*[0-9]*",
|
||||
"OFL-*[0-9]*",
|
||||
]),
|
||||
("lilypond", &["*.ly", "*.ily"]),
|
||||
("lisp", &["*.el", "*.jl", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
|
||||
("lock", &["*.lock", "package-lock.json"]),
|
||||
("log", &["*.log"]),
|
||||
@@ -152,6 +163,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
("objcpp", &["*.h", "*.mm"]),
|
||||
("ocaml", &["*.ml", "*.mli", "*.mll", "*.mly"]),
|
||||
("org", &["*.org", "*.org_archive"]),
|
||||
("pants", &["BUILD"]),
|
||||
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
|
||||
("pdf", &["*.pdf"]),
|
||||
("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
|
||||
@@ -225,6 +237,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
("taskpaper", &["*.taskpaper"]),
|
||||
("tcl", &["*.tcl"]),
|
||||
("tex", &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
|
||||
("texinfo", &["*.texi"]),
|
||||
("textile", &["*.textile"]),
|
||||
("tf", &["*.tf"]),
|
||||
("thrift", &["*.thrift"]),
|
||||
@@ -238,8 +251,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
||||
("vcl", &["*.vcl"]),
|
||||
("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
|
||||
("vhdl", &["*.vhd", "*.vhdl"]),
|
||||
("vim", &["*.vim"]),
|
||||
("vimscript", &["*.vim"]),
|
||||
("vim", &[
|
||||
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
||||
]),
|
||||
("vimscript", &[
|
||||
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
||||
]),
|
||||
("webidl", &["*.idl", "*.webidl", "*.widl"]),
|
||||
("wiki", &["*.mediawiki", "*.wiki"]),
|
||||
("xml", &[
|
||||
|
@@ -202,11 +202,12 @@ impl Ignore {
|
||||
errs.maybe_push(err);
|
||||
igtmp.is_absolute_parent = true;
|
||||
igtmp.absolute_base = Some(absolute_base.clone());
|
||||
igtmp.has_git = if self.0.opts.git_ignore {
|
||||
parent.join(".git").exists()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
igtmp.has_git =
|
||||
if self.0.opts.require_git && self.0.opts.git_ignore {
|
||||
parent.join(".git").exists()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
ig = Ignore(Arc::new(igtmp));
|
||||
compiled.insert(parent.as_os_str().to_os_string(), ig.clone());
|
||||
}
|
||||
@@ -231,7 +232,9 @@ impl Ignore {
|
||||
|
||||
/// Like add_child, but takes a full path and returns an IgnoreInner.
|
||||
fn add_child_path(&self, dir: &Path) -> (IgnoreInner, Option<Error>) {
|
||||
let git_type = if self.0.opts.git_ignore || self.0.opts.git_exclude {
|
||||
let git_type = if self.0.opts.require_git
|
||||
&& (self.0.opts.git_ignore || self.0.opts.git_exclude)
|
||||
{
|
||||
dir.join(".git").metadata().ok().map(|md| md.file_type())
|
||||
} else {
|
||||
None
|
||||
|
@@ -474,10 +474,13 @@ impl GitignoreBuilder {
|
||||
}
|
||||
// If it ends with a slash, then this should only match directories,
|
||||
// but the slash should otherwise not be used while globbing.
|
||||
if let Some((i, c)) = line.char_indices().rev().nth(0) {
|
||||
if c == '/' {
|
||||
glob.is_only_dir = true;
|
||||
line = &line[..i];
|
||||
if line.as_bytes().last() == Some(&b'/') {
|
||||
glob.is_only_dir = true;
|
||||
line = &line[..line.len() - 1];
|
||||
// If the slash was escaped, then remove the escape.
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2236
|
||||
if line.as_bytes().last() == Some(&b'\\') {
|
||||
line = &line[..line.len() - 1];
|
||||
}
|
||||
}
|
||||
glob.actual = line.to_string();
|
||||
|
@@ -122,10 +122,6 @@ enum GlobInner<'a> {
|
||||
Matched {
|
||||
/// The file type definition which provided the glob.
|
||||
def: &'a FileTypeDef,
|
||||
/// The index of the glob that matched inside the file type definition.
|
||||
which: usize,
|
||||
/// Whether the selection was negated or not.
|
||||
negated: bool,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -291,13 +287,9 @@ impl Types {
|
||||
self.set.matches_into(name, &mut *matches);
|
||||
// The highest precedent match is the last one.
|
||||
if let Some(&i) = matches.last() {
|
||||
let (isel, iglob) = self.glob_to_selection[i];
|
||||
let (isel, _) = self.glob_to_selection[i];
|
||||
let sel = &self.selections[isel];
|
||||
let glob = Glob(GlobInner::Matched {
|
||||
def: sel.inner(),
|
||||
which: iglob,
|
||||
negated: sel.is_negated(),
|
||||
});
|
||||
let glob = Glob(GlobInner::Matched { def: sel.inner() });
|
||||
return if sel.is_negated() {
|
||||
Match::Ignore(glob)
|
||||
} else {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-matcher"
|
||||
version = "0.1.4" #:version
|
||||
version = "0.1.5" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
A trait for regular expressions, with a focus on line oriented search.
|
||||
@@ -10,7 +10,7 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/matcher"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/matcher"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "pattern", "trait"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
autotests = false
|
||||
edition = "2018"
|
||||
|
||||
|
@@ -116,7 +116,7 @@ impl Match {
|
||||
/// This method panics if `start > self.end`.
|
||||
#[inline]
|
||||
pub fn with_start(&self, start: usize) -> Match {
|
||||
assert!(start <= self.end);
|
||||
assert!(start <= self.end, "{} is not <= {}", start, self.end);
|
||||
Match { start, ..*self }
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ impl Match {
|
||||
/// This method panics if `self.start > end`.
|
||||
#[inline]
|
||||
pub fn with_end(&self, end: usize) -> Match {
|
||||
assert!(self.start <= end);
|
||||
assert!(self.start <= end, "{} is not <= {}", self.start, end);
|
||||
Match { end, ..*self }
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-pcre2"
|
||||
version = "0.1.4" #:version
|
||||
version = "0.1.5" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use PCRE2 with the 'grep' crate.
|
||||
@@ -10,9 +10,9 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/pcre2"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/pcre2"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "grep", "pcre", "backreference", "look"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
pcre2 = "0.2.0"
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
pcre2 = "0.2.3"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-printer"
|
||||
version = "0.1.5" #:version
|
||||
version = "0.1.6" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
An implementation of the grep crate's Sink trait that provides standard
|
||||
@@ -11,7 +11,7 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/printer"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/printer"
|
||||
readme = "README.md"
|
||||
keywords = ["grep", "pattern", "print", "printer", "sink"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
@@ -21,11 +21,11 @@ serde1 = ["base64", "serde", "serde_json"]
|
||||
[dependencies]
|
||||
base64 = { version = "0.13.0", optional = true }
|
||||
bstr = "0.2.0"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-searcher = { version = "0.1.4", path = "../searcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
grep-searcher = { version = "0.1.8", path = "../searcher" }
|
||||
termcolor = "1.0.4"
|
||||
serde = { version = "1.0.77", optional = true, features = ["derive"] }
|
||||
serde_json = { version = "1.0.27", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.3", path = "../regex" }
|
||||
grep-regex = { version = "0.1.9", path = "../regex" }
|
||||
|
@@ -147,7 +147,7 @@ impl JSONBuilder {
|
||||
/// is not limited to UTF-8 exclusively, which in turn implies that matches
|
||||
/// may be reported that contain invalid UTF-8. Moreover, this printer may
|
||||
/// also print file paths, and the encoding of file paths is itself not
|
||||
/// guarnateed to be valid UTF-8. Therefore, this printer must deal with the
|
||||
/// guaranteed to be valid UTF-8. Therefore, this printer must deal with the
|
||||
/// presence of invalid UTF-8 somehow. The printer could silently ignore such
|
||||
/// things completely, or even lossily transcode invalid UTF-8 to valid UTF-8
|
||||
/// by replacing all invalid sequences with the Unicode replacement character.
|
||||
|
@@ -1594,7 +1594,7 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
|
||||
/// multiple lines.
|
||||
///
|
||||
/// Note that this doesn't just return whether the searcher is in multi
|
||||
/// line mode, but also checks if the mater can match over multiple lines.
|
||||
/// line mode, but also checks if the matter can match over multiple lines.
|
||||
/// If it can't, then we don't need multi line handling, even if the
|
||||
/// searcher has multi line mode enabled.
|
||||
fn multi_line(&self) -> bool {
|
||||
|
@@ -508,7 +508,7 @@ impl<'p, 's, M: Matcher, W: WriteColor> SummarySink<'p, 's, M, W> {
|
||||
/// multiple lines.
|
||||
///
|
||||
/// Note that this doesn't just return whether the searcher is in multi
|
||||
/// line mode, but also checks if the mater can match over multiple lines.
|
||||
/// line mode, but also checks if the matter can match over multiple lines.
|
||||
/// If it can't, then we don't need multi line handling, even if the
|
||||
/// searcher has multi line mode enabled.
|
||||
fn multi_line(&self, searcher: &Searcher) -> bool {
|
||||
|
@@ -82,26 +82,26 @@ impl<M: Matcher> Replacer<M> {
|
||||
dst.clear();
|
||||
matches.clear();
|
||||
|
||||
matcher
|
||||
.replace_with_captures_at(
|
||||
subject,
|
||||
range.start,
|
||||
caps,
|
||||
dst,
|
||||
|caps, dst| {
|
||||
let start = dst.len();
|
||||
caps.interpolate(
|
||||
|name| matcher.capture_index(name),
|
||||
subject,
|
||||
replacement,
|
||||
dst,
|
||||
);
|
||||
let end = dst.len();
|
||||
matches.push(Match::new(start, end));
|
||||
true
|
||||
},
|
||||
)
|
||||
.map_err(io::Error::error_message)?;
|
||||
replace_with_captures_in_context(
|
||||
matcher,
|
||||
subject,
|
||||
range.clone(),
|
||||
caps,
|
||||
dst,
|
||||
|caps, dst| {
|
||||
let start = dst.len();
|
||||
caps.interpolate(
|
||||
|name| matcher.capture_index(name),
|
||||
subject,
|
||||
replacement,
|
||||
dst,
|
||||
);
|
||||
let end = dst.len();
|
||||
matches.push(Match::new(start, end));
|
||||
true
|
||||
},
|
||||
)
|
||||
.map_err(io::Error::error_message)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -458,3 +458,33 @@ pub fn trim_line_terminator(
|
||||
*line = line.with_end(end);
|
||||
}
|
||||
}
|
||||
|
||||
/// Like `Matcher::replace_with_captures_at`, but accepts an end bound.
|
||||
///
|
||||
/// See also: `find_iter_at_in_context` for why we need this.
|
||||
fn replace_with_captures_in_context<M, F>(
|
||||
matcher: M,
|
||||
bytes: &[u8],
|
||||
range: std::ops::Range<usize>,
|
||||
caps: &mut M::Captures,
|
||||
dst: &mut Vec<u8>,
|
||||
mut append: F,
|
||||
) -> Result<(), M::Error>
|
||||
where
|
||||
M: Matcher,
|
||||
F: FnMut(&M::Captures, &mut Vec<u8>) -> bool,
|
||||
{
|
||||
let mut last_match = range.start;
|
||||
matcher.captures_iter_at(bytes, range.start, caps, |caps| {
|
||||
let m = caps.get(0).unwrap();
|
||||
if m.start() >= range.end {
|
||||
return false;
|
||||
}
|
||||
dst.extend(&bytes[last_match..m.start()]);
|
||||
last_match = m.end();
|
||||
append(caps, dst)
|
||||
})?;
|
||||
let end = std::cmp::min(bytes.len(), range.end);
|
||||
dst.extend(&bytes[last_match..end]);
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-regex"
|
||||
version = "0.1.8" #:version
|
||||
version = "0.1.10" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Use Rust's regex library with the 'grep' crate.
|
||||
@@ -10,13 +10,13 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/regex"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/regex"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "grep", "search", "pattern", "line"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
aho-corasick = "0.7.3"
|
||||
bstr = "0.2.10"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
log = "0.4.5"
|
||||
regex = "1.1"
|
||||
regex-syntax = "0.6.5"
|
||||
|
@@ -175,6 +175,36 @@ impl ConfiguredHIR {
|
||||
self.config.crlf && self.expr.is_line_anchored_end()
|
||||
}
|
||||
|
||||
/// Returns the line terminator configured on this expression.
|
||||
///
|
||||
/// When we have beginning/end anchors (NOT line anchors), the fast line
|
||||
/// searching path isn't quite correct. Or at least, doesn't match the
|
||||
/// slow path. Namely, the slow path strips line terminators while the
|
||||
/// fast path does not. Since '$' (when multi-line mode is disabled)
|
||||
/// doesn't match at line boundaries, the existence of a line terminator
|
||||
/// might cause it to not match when it otherwise would with the line
|
||||
/// terminator stripped.
|
||||
///
|
||||
/// Since searching with text anchors is exceptionally rare in the
|
||||
/// context of line oriented searching (multi-line mode is basically
|
||||
/// always enabled), we just disable this optimization when there are
|
||||
/// text anchors. We disable it by not returning a line terminator, since
|
||||
/// without a line terminator, the fast search path can't be executed.
|
||||
///
|
||||
/// See: https://github.com/BurntSushi/ripgrep/issues/2260
|
||||
pub fn line_terminator(&self) -> Option<LineTerminator> {
|
||||
if self.is_any_anchored() {
|
||||
None
|
||||
} else {
|
||||
self.config.line_terminator
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if and only if the underlying HIR has any text anchors.
|
||||
fn is_any_anchored(&self) -> bool {
|
||||
self.expr.is_any_anchored_start() || self.expr.is_any_anchored_end()
|
||||
}
|
||||
|
||||
/// Builds a regular expression from this HIR expression.
|
||||
pub fn regex(&self) -> Result<Regex, Error> {
|
||||
self.pattern_to_regex(&self.expr.to_string())
|
||||
|
@@ -52,8 +52,12 @@ impl RegexMatcherBuilder {
|
||||
|
||||
let matcher = RegexMatcherImpl::new(&chir)?;
|
||||
log::trace!("final regex: {:?}", matcher.regex());
|
||||
let mut config = self.config.clone();
|
||||
// We override the line terminator in case the configured expr doesn't
|
||||
// support it.
|
||||
config.line_terminator = chir.line_terminator();
|
||||
Ok(RegexMatcher {
|
||||
config: self.config.clone(),
|
||||
config,
|
||||
matcher,
|
||||
fast_line_regex,
|
||||
non_matching_bytes,
|
||||
|
@@ -111,8 +111,15 @@ impl WordMatcher {
|
||||
}
|
||||
let (_, slen) = bstr::decode_utf8(&haystack[cand]);
|
||||
let (_, elen) = bstr::decode_last_utf8(&haystack[cand]);
|
||||
cand =
|
||||
cand.with_start(cand.start() + slen).with_end(cand.end() - elen);
|
||||
let new_start = cand.start() + slen;
|
||||
let new_end = cand.end() - elen;
|
||||
// This occurs the original regex can match the empty string. In this
|
||||
// case, just bail instead of trying to get it right here since it's
|
||||
// likely a pathological case.
|
||||
if new_start > new_end {
|
||||
return Err(());
|
||||
}
|
||||
cand = cand.with_start(new_start).with_end(new_end);
|
||||
if self.original.is_match(&haystack[cand]) {
|
||||
Ok(Some(cand))
|
||||
} else {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grep-searcher"
|
||||
version = "0.1.7" #:version
|
||||
version = "0.1.10" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Fast line oriented regex searching as a library.
|
||||
@@ -10,7 +10,7 @@ homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/searcher"
|
||||
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/searcher"
|
||||
readme = "README.md"
|
||||
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
||||
license = "Unlicense/MIT"
|
||||
license = "Unlicense OR MIT"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
@@ -18,12 +18,12 @@ bstr = { version = "0.2.0", default-features = false, features = ["std"] }
|
||||
bytecount = "0.6"
|
||||
encoding_rs = "0.8.14"
|
||||
encoding_rs_io = "0.1.6"
|
||||
grep-matcher = { version = "0.1.2", path = "../matcher" }
|
||||
grep-matcher = { version = "0.1.5", path = "../matcher" }
|
||||
log = "0.4.5"
|
||||
memmap = { package = "memmap2", version = "0.3.0" }
|
||||
memmap = { package = "memmap2", version = "0.5.3" }
|
||||
|
||||
[dev-dependencies]
|
||||
grep-regex = { version = "0.1.3", path = "../regex" }
|
||||
grep-regex = { version = "0.1.10", path = "../regex" }
|
||||
regex = "1.1"
|
||||
|
||||
[features]
|
||||
|
@@ -467,6 +467,7 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
|
||||
let keepgoing = self.sink.context(
|
||||
&self.searcher,
|
||||
&SinkContext {
|
||||
#[cfg(test)]
|
||||
line_term: self.config.line_term,
|
||||
bytes: &buf[*range],
|
||||
kind: SinkContextKind::Before,
|
||||
@@ -497,6 +498,7 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
|
||||
let keepgoing = self.sink.context(
|
||||
&self.searcher,
|
||||
&SinkContext {
|
||||
#[cfg(test)]
|
||||
line_term: self.config.line_term,
|
||||
bytes: &buf[*range],
|
||||
kind: SinkContextKind::After,
|
||||
@@ -526,6 +528,7 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
|
||||
let keepgoing = self.sink.context(
|
||||
&self.searcher,
|
||||
&SinkContext {
|
||||
#[cfg(test)]
|
||||
line_term: self.config.line_term,
|
||||
bytes: &buf[*range],
|
||||
kind: SinkContextKind::Other,
|
||||
|
@@ -88,7 +88,6 @@ where
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SliceByLine<'s, M, S> {
|
||||
config: &'s Config,
|
||||
core: Core<'s, M, S>,
|
||||
slice: &'s [u8],
|
||||
}
|
||||
@@ -103,7 +102,6 @@ impl<'s, M: Matcher, S: Sink> SliceByLine<'s, M, S> {
|
||||
debug_assert!(!searcher.multi_line_with_matcher(&matcher));
|
||||
|
||||
SliceByLine {
|
||||
config: &searcher.config,
|
||||
core: Core::new(searcher, matcher, write_to, true),
|
||||
slice: slice,
|
||||
}
|
||||
@@ -1514,4 +1512,31 @@ and exhibited clearly, with a label attached.\
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2260
|
||||
#[test]
|
||||
fn regression_2260() {
|
||||
use grep_regex::RegexMatcherBuilder;
|
||||
|
||||
use crate::SearcherBuilder;
|
||||
|
||||
let matcher = RegexMatcherBuilder::new()
|
||||
.line_terminator(Some(b'\n'))
|
||||
.build(r"^\w+$")
|
||||
.unwrap();
|
||||
let mut searcher = SearcherBuilder::new().line_number(true).build();
|
||||
|
||||
let mut matched = false;
|
||||
searcher
|
||||
.search_slice(
|
||||
&matcher,
|
||||
b"GATC\n",
|
||||
crate::sinks::UTF8(|_, _| {
|
||||
matched = true;
|
||||
Ok(true)
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(matched);
|
||||
}
|
||||
}
|
||||
|
@@ -71,6 +71,16 @@ impl MmapChoice {
|
||||
if !self.is_enabled() {
|
||||
return None;
|
||||
}
|
||||
if !cfg!(target_pointer_width = "64") {
|
||||
// For 32-bit systems, it looks like mmap will succeed even if it
|
||||
// can't address the entire file. This seems to happen at least on
|
||||
// Windows, even though it uses to work prior to ripgrep 13. The
|
||||
// only Windows-related change in ripgrep 13, AFAIK, was statically
|
||||
// linking vcruntime. So maybe that's related? But I'm not sure.
|
||||
//
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/1911
|
||||
return None;
|
||||
}
|
||||
if cfg!(target_os = "macos") {
|
||||
// I guess memory maps on macOS aren't great. Should re-evaluate.
|
||||
return None;
|
||||
|
@@ -436,6 +436,7 @@ pub enum SinkContextKind {
|
||||
/// A type that describes a contextual line reported by a searcher.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SinkContext<'b> {
|
||||
#[cfg(test)]
|
||||
pub(crate) line_term: LineTerminator,
|
||||
pub(crate) bytes: &'b [u8],
|
||||
pub(crate) kind: SinkContextKind,
|
||||
|
@@ -1,14 +1,14 @@
|
||||
class RipgrepBin < Formula
|
||||
version '12.1.1'
|
||||
version '13.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 "7ff2fd5dd3a438d62fae5866ddae78cf542b733116f58cf21ab691a58c385703"
|
||||
sha256 "585c18350cb8d4392461edd6c921e6edd5a97cbfc03b567d7bd440423e118082"
|
||||
elsif OS.linux?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
|
||||
sha256 "88d3b735e43f6f16a0181a8fec48847693fae80168d5f889fdbdeb962f1fc804"
|
||||
sha256 "ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091"
|
||||
end
|
||||
|
||||
conflicts_with "ripgrep"
|
||||
|
@@ -1029,3 +1029,100 @@ rgtest!(r1878, |dir: Dir, _: TestCommand| {
|
||||
let args = &["-U", "--mmap", r"\Abaz", "test"];
|
||||
dir.command().args(args).assert_err();
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/1891
|
||||
rgtest!(r1891, |dir: Dir, mut cmd: TestCommand| {
|
||||
// TODO: Sadly, PCRE2 has different behavior here. Not clear why. We should
|
||||
// look into this and see if there's a fix needed at the regex engine
|
||||
// level.
|
||||
if dir.is_pcre2() {
|
||||
return;
|
||||
}
|
||||
|
||||
dir.create("test", "\n##\n");
|
||||
// N.B. We use -o here to force the issue to occur, which seems to only
|
||||
// happen when each match needs to be detected.
|
||||
eqnice!("1:\n2:\n2:\n", cmd.args(&["-won", "", "test"]).stdout());
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2095
|
||||
rgtest!(r2095, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create(
|
||||
"test",
|
||||
"#!/usr/bin/env bash
|
||||
|
||||
zero=one
|
||||
|
||||
a=one
|
||||
|
||||
if true; then
|
||||
a=(
|
||||
a
|
||||
b
|
||||
c
|
||||
)
|
||||
true
|
||||
fi
|
||||
|
||||
a=two
|
||||
|
||||
b=one
|
||||
});
|
||||
",
|
||||
);
|
||||
cmd.args(&[
|
||||
"--line-number",
|
||||
"--multiline",
|
||||
"--only-matching",
|
||||
"--replace",
|
||||
"${value}",
|
||||
r"^(?P<indent>\s*)a=(?P<value>(?ms:[(].*?[)])|.*?)$",
|
||||
"test",
|
||||
]);
|
||||
let expected = "4:one
|
||||
8:(
|
||||
9: a
|
||||
10: b
|
||||
11: c
|
||||
12: )
|
||||
15:two
|
||||
";
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2208
|
||||
rgtest!(r2208, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create("test", "# Compile requirements.txt files from all found or specified requirements.in files (compile).
|
||||
# Use -h to include hashes, -u dep1,dep2... to upgrade specific dependencies, and -U to upgrade all.
|
||||
pipc () { # [-h] [-U|-u <pkgspec>[,<pkgspec>...]] [<reqs-in>...] [-- <pip-compile-arg>...]
|
||||
emulate -L zsh
|
||||
unset REPLY
|
||||
if [[ $1 == --help ]] { zpy $0; return }
|
||||
[[ $ZPY_PROCS ]] || return
|
||||
|
||||
local gen_hashes upgrade upgrade_csv
|
||||
while [[ $1 == -[hUu] ]] {
|
||||
if [[ $1 == -h ]] { gen_hashes=--generate-hashes; shift }
|
||||
if [[ $1 == -U ]] { upgrade=1; shift }
|
||||
if [[ $1 == -u ]] { upgrade=1; upgrade_csv=$2; shift 2 }
|
||||
}
|
||||
}
|
||||
");
|
||||
cmd.args(&[
|
||||
"-N",
|
||||
"-U",
|
||||
"-r", "$usage",
|
||||
r#"^(?P<predoc>\n?(# .*\n)*)(alias (?P<aname>pipc)="[^"]+"|(?P<fname>pipc) \(\) \{)( #(?P<usage> .+))?"#,
|
||||
"test",
|
||||
]);
|
||||
let expected = " [-h] [-U|-u <pkgspec>[,<pkgspec>...]] [<reqs-in>...] [-- <pip-compile-arg>...]\n";
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2236
|
||||
rgtest!(r2236, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create(".ignore", r"foo\/");
|
||||
dir.create_dir("foo");
|
||||
dir.create("foo/bar", "test\n");
|
||||
cmd.args(&["test"]).assert_err();
|
||||
});
|
||||
|
Reference in New Issue
Block a user