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

1577 Commits

Author SHA1 Message Date
Andrew Gallant
a6a24bafb3 fix minimum Rust version 2017-01-09 20:02:29 -05:00
Andrew Gallant
db27a33827 remove redundant words 2017-01-09 20:01:26 -05:00
Andrew Gallant
083fb73790 add anti-pitch 2017-01-09 19:55:56 -05:00
Andrew Gallant
461e0c4e33 Don't search stdout redirected file.
When running ripgrep like this:

    rg foo > output

we must be careful not to search `output` since ripgrep is actively writing
to it. Searching it can cause massive blowups where the file grows without
bound.

While this is conceptually easy to fix (check the inode of the redirection
and the inode of the file you're about to search), there are a few problems
with it.

First, inodes are a Unix thing, so we need a Windows specific solution to
this as well. To resolve this concern, I created a new crate, `same-file`,
which provides a cross platform abstraction.

Second, stat'ing every file is costly. This is not avoidable on Windows,
but on Unix, we can get the inode number directly from directory traversal.
However, this information wasn't exposed, but now it is (through both the
ignore and walkdir crates).

Fixes #286
2017-01-09 16:12:08 -05:00
chocolateboy
82df3b7685 add Kotlin type: "*.kt", "*.kts"
https://en.wikipedia.org/wiki/Kotlin_(programming_language)
https://github.com/udalov/kotlin-vim/blob/master/ftdetect/kotlin.vim
2017-01-09 16:11:47 -05:00
chocolateboy
ece6011164 Ruby type: add "Gemfile", "*.gemspec", ".irbrc", "Rakefile"
https://github.com/vim-ruby/vim-ruby/blob/master/ftdetect/ruby.vim
2017-01-09 16:11:47 -05:00
chocolateboy
00033e1875 Perl type: add "*.t"
https://github.com/petdance/ack2/blob/2.15_02/ConfigDefault.pm#L155
2017-01-09 16:11:47 -05:00
chocolateboy
5aea517fb4 add Crystal type: "Projectfile", "*.cr"
https://en.wikipedia.org/wiki/Crystal_(programming_language)
https://github.com/rhysd/vim-crystal/blob/master/ftdetect/crystal.vim
2017-01-09 16:11:47 -05:00
Daniel Luz
073ff35ebb Sync documented threads cap to code. 2017-01-08 17:02:57 -05:00
Daniel Luz
c4633ff187 Remove trivial condition. 2017-01-08 17:02:57 -05:00
Andrew Gallant
97e6873b38 Fix type compose test. 2017-01-07 22:50:38 -05:00
Ian Kerins
ed01e80a79 Provide a mechanism to compose type definitions
This extends the syntax of the --type-add flag to allow including the globs of
other already defined types.

Fixes #83.
2017-01-07 18:14:24 -05:00
Andrew Gallant
8f7b9be356 Add docs for shell completion files.
Add small howtos for installing shell completion files to the README and
the man page.

They are still incomplete. We're missing Zsh and PowerShell.

Fixes #262
2017-01-06 22:52:57 -05:00
Andrew Gallant
851799f42b Fix spacing issue in --help output. 2017-01-06 22:45:12 -05:00
Andrew Gallant
b65a8c353b Add --sort-files flag.
When used, parallelism is disabled but the results are sorted by file
path.

Closes #263
2017-01-06 22:43:59 -05:00
Andrew Gallant
95cea77625 Tweak the parallel directory iterator.
This commit fixes two issues.

First, the iterator was executing the callback for every child of a
directory in a single thread. Therefore, if the walker was run over a
single directory, then no parallelism is used. We tweak the iterator
slightly so that we don't fall into this trap.

The second issue is a bit more subtle. In particular, we don't use the
blocking semantics of MsQueue because we *don't know when iteration
finishes*. This means that if there are a bunch of idle workers because
there is no work available to them, then they will spin and burn the
CPU. One case where this crops up is if you pipe the output of ripgrep
into `less` *and* the total number of files to search is fewer than the
number of threads ripgrep uses. We "fix" this with a very stupid
heuristic: when the queue yields no work, we sleep the thread for 1ms.
This still pegs the CPU, but not nearly as much as before.

If one really want to avoid this behavior when using ripgrep, then `-j1`
can be used to disable parallelism.

Fixes #258
2017-01-06 21:43:49 -05:00
Andrew Gallant
b187c1a817 Rejigger bold and intense settings.
Previously, ripgrep would only emit the 'bold' ANSI escape sequence if
no foreground or background color was set. Instead, it would convert colors
to their "intense" versions if bold was set. The intent was to do the same
thing on Windows and Unix. However, this had a few negative side effects:

  1. Omitting the 'bold' ANSI escape when 'bold' was set is surprising.
  2. Intense colors can look quite bad and be hard to read.

To fix this, we introduce a new setting called 'intense' in the --colors
flag, and thread that down through to the public API of the `termcolor`
crate. The 'intense' setting has environment specific behavior:

  1. In ANSI mode, it will convert the selected color to its "intense"
     variant.
  2. In the Windows console, it will make the text "intense."

There is no longer any "smart" handling of the 'bold' style. The 'bold'
ANSI escape is always emitted when it is selected. In the Windows
console, the 'bold' setting now has no effect. Note that this is a
breaking change.

Fixes #266, #293
2017-01-06 20:09:51 -05:00
Jason Shirk (POWERSHELL)
f7a2fe30d4 Add powershell as a known file type 2017-01-06 08:18:15 -05:00
Andrew Gallant
aed315e80a bump deps 2017-01-03 07:27:51 -05:00
Andrew Gallant
2f0d9d411a Tweak build matrix.
Only build darwin on nightly for deployment. (Darwin builders are quite
slow on Travis.)

Also, add MUSL to Rust 1.12.0 builder.
2017-01-02 15:51:45 -05:00
Andrew Gallant
163e00677a Update to regex 0.2. 2017-01-01 01:03:21 -05:00
Andrew Gallant
d58236fbdc bump various versions 2016-12-30 15:44:08 -05:00
Matěj Cepl
932875684e Add types for handling SWIG files. (#297)
SWIG from http://swig.org/

Fixes #296
2016-12-29 21:01:10 -05:00
Andrew Gallant
b65bb37b14 Remove superfluous memmap dependency in grep crate.
Fixes #295.
2016-12-27 15:46:40 -05:00
Andrew Gallant
de5cb7d22e Remove special ^C handling.
This means that ripgrep will no longer try to reset your colors in your
terminal if you kill it while searching. This could result in messing up
the colors in your terminal, and the fix is to simply run some other
command that resets them for you. For example:

    $ echo -ne "\033[0m"

The reason why the ^C handling was removed is because it is irrevocably
broken on Windows and is impossible to do correctly and efficiently in
ANSI terminals.

Fixes #281
2016-12-24 12:53:09 -05:00
Andrew Gallant
7a682f465e add docs to wincolor 2016-12-24 10:49:43 -05:00
Andrew Gallant
084d3f4911 Small code cleanups. 2016-12-24 10:06:37 -05:00
Andrew Gallant
9911cd0cd9 Remove ~ dependency on clap.
The point of the ~ dependency was to avoid implicitly increasing the
minimum Rust version required to compile ripgrep. However, clap's policy
is to support at least two prior releases of Rust (which roughly
corresponds to the convention that others use too), and that is probably
good enough.

The problem with using a ~ dependency is that it can make packaging
ripgrep in Linux distros difficult, because it means the packager may be
forced to package multiple compatible versions of the same library.

Fixes #271
2016-12-24 09:58:15 -05:00
Andrew Gallant
de91c26bb1 Add some additional benchmark runs.
2016-12-24-archlinux-cheetah uses the same setup/compile config as
2016-09-22-archlinux-cheetah. The improvements are nice.

The other 2016-12-24-archlinux-cheetah-* benchmarks try to suss out
a difference between MUSL, glibc, jemalloc and the system allocator.
2016-12-24 09:15:09 -05:00
Andrew Gallant
5b1796d64d Add some commented out commands to compile script. 2016-12-24 09:13:53 -05:00
Andrew Gallant
d4527854de Add --disabled flag to benchsuite.
This allows one to selectively choose which commands aren't
benchmarked.
2016-12-24 09:08:06 -05:00
Andrew Gallant
82ceb818f3 update deps 2016-12-24 08:32:32 -05:00
Leonardo Yvens
dd5ded2f78 fix some clippy lints (#288) 2016-12-23 14:53:35 -05:00
Lilian Anatolie Moraru
cbacf4f19e Update Cargo.lock to bring in clap 2.19.2 fix for ZSH completions. (#287) 2016-12-23 06:47:55 -05:00
YPCrumble
900ef0abc7 Update docs to explain use of -g and --files to search for paths. (#285)
Update docs to explain use of -g and --files to search for paths.

Fixes #284
2016-12-22 07:21:22 -05:00
Andrew Gallant
8396d3ffaa Make backreference support clear.
Fixes #268.
2016-12-12 07:03:37 -05:00
Andrew Gallant
652c70f207 Fix cut-off line in globset docs.
Fixes #277
2016-12-12 06:58:33 -05:00
Andrew Gallant
bb70f96743 Fix a non-termination bug.
This was a very silly bug. Instead of creating a particular atomic once
and cloning it, we created a new value for each worker.

Fixes #279
2016-12-12 06:55:49 -05:00
Andrew Gallant
6d346a09de update brew tap 2016-12-07 12:04:12 -05:00
Andrew Gallant
699c76f45c fix ci 2016-12-07 11:13:44 -05:00
Andrew Gallant
de33003527 0.3.2 2016-12-07 10:59:06 -05:00
Andrew Gallant
3e943636f4 changelog 0.3.2 2016-12-07 10:58:31 -05:00
Andrew Gallant
3f515afbb4 Fix completion build.rs 2016-12-07 10:32:30 -05:00
Andrew Gallant
30db03bb62 Merge pull request #272 from BurntSushi/fix-270
Fix leading hypen bug by updating clap.
2016-12-07 10:32:01 -05:00
Andrew Gallant
d66812102b Fix leading hypen bug by updating clap.
Fixes #270
2016-12-06 17:29:34 -05:00
Andrew Gallant
86f8c3c818 update Cargo.lock 2016-12-05 20:15:45 -05:00
Andrew Gallant
5eb2ca4338 try removing cache 2016-12-05 20:14:58 -05:00
Andrew Gallant
20bcb8d883 ignore-0.1.6 2016-12-05 20:11:48 -05:00
Andrew Gallant
7282706b42 Fix bug reading root symlink.
When give an explicit file path on the command line like `foo` where `foo`
is a symlink, ripgrep should follow it even if `-L` isn't set. This is
consistent with the behavior of `foo/`.

Fixes #256
2016-12-05 20:05:57 -05:00
Andrew Gallant
160f04894f Simplify code.
Instead of `Ok(n) if n == 0` we can just write `Ok(0)`.
2016-12-04 12:00:13 -05:00