diff options
author | Andrew Gallant <jamslam@gmail.com> | 2020-02-16 21:03:07 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2020-02-17 17:16:28 -0500 |
commit | 0c3b673e4c64c6e9c580b15ff8cf9c2a21c29cbd (patch) | |
tree | f3e38ecdffaf92a5f1b95f61eb779f6f64a6ce11 /CHANGELOG.md | |
parent | 297b428c8c92dca2c62d57dd41ad085aa94c4aa4 (diff) |
cli: make ripgrep work in non-existent directories
It turns out that querying the CWD while in a directory that no longer
exists results in an error. Since the CWD is queried every time ripgrep
starts---whether it needs it or not---for dealing with glob matching,
ripgrep winds up being completely useless inside a non-existent
directory.
We fix this in a few different ways:
* Firstly, if std::env::current_dir() fails, then we fall back to trying
to read the `PWD` environment variable.
* If that fails, that we return a more sensible error message so that a
user can at least react to the problem. Previously, the error message
was inscrutable.
* Finally, we try to avoid the problem altogether by building empty glob
matchers if not globs were provided, thus side-stepping querying the
CWD completely.
Fixes #1291, Closes #1400
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r-- | CHANGELOG.md | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a3e9f1a..4b6fd070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ Feature enhancements: Bug fixes: +* [BUG #1291](https://github.com/BurntSushi/ripgrep/issues/1291): + ripgrep now works in non-existent directories. * [BUG #1335](https://github.com/BurntSushi/ripgrep/issues/1335): Fixes a performance bug when searching plain text files with very long lines. * [BUG #1344](https://github.com/BurntSushi/ripgrep/issues/1344): |