diff options
author | Ninan John <jninan@thoughtworks.com> | 2019-06-05 21:03:52 +0530 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2019-08-01 17:27:23 -0400 |
commit | 9268ff8e8db179a484810cfbc40f3a8dba74ccaf (patch) | |
tree | 1c3dce162794783bbc7c9faf7fe40a75a0351786 /src/app.rs | |
parent | c2cb0a4de4597c8f911c8ebece6aa0435ef5da6f (diff) |
ripgrep: fix bug when CWD has directory named `-`
Specifically, when searching stdin, if the current directory has a
directory named `-`, then the `--with-filename` flag would automatically
be turned on. This is because `--with-filename` is automatically enabled
when ripgrep is given a single path that is a directory. When ripgrep is
given empty arguments, and if it is searching stdin, then its default
path list is just simple `["-"]`. The `is_dir` check passes, and
`--with-filename` gets enabled.
This commit fixes the problem by checking whether the path is `-` first.
If so, then we assume it isn't a directory. This is fine, since if it is
a directory and one asks to search it explicitly, then ripgrep will
interpret `-` as stdin anyway (which is arguably a bug on its own, but
probably not one worth fixing).
Fixes #1223, Closes #1292
Diffstat (limited to 'src/app.rs')
0 files changed, 0 insertions, 0 deletions