ripgrep icon indicating copy to clipboard operation
ripgrep copied to clipboard

support empty alternate glob patterns

Open StaticPH opened this issue 4 years ago • 2 comments

What version of ripgrep are you using?

ripgrep 11.0.2
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

Installed with cargo

What operating system are you using ripgrep on?

Windows 8.1 Pro (x86_64) If it's relevant, I'm also using the latest version of msys2-x86_64

Describe your question, feature request, or bug.

Bash and ripgrep evaluate globs differently, which seems like a bug to me. If this behavior is actually intended, I'd like help finding a glob pattern that will give the result bash does for my test pattern.

If this is a bug, what are the steps to reproduce the behavior?

In a directory I have 5 files containing only the string 'qwertyuiop' The files are named: '.foo' '.foo_baz' 'bar.foo' 'baz.foo_bar' 'SHOULD_NOT_BE_GLOBBED'

I do not have any .ignore-like files, am not instructing ripgrep to use a configuration file, and have not set RIPGREP_CONFIG_PATH

The glob pattern I am using for this test is {*,}.foo{_*,} The regex is simply "\D", which should match every character in the 5 files

If this is a bug, what is the actual behavior?

See https://gist.github.com/StaticPH/c52d9ddee8a1a43a23196f5f46f1503e

If this is a bug, what is the expected behavior?

Simply calling echo {*,}.foo{_*,} in bash prints out baz.foo_bar bar.foo .foo_baz .foo, so I would have expected both

~/.cargo/bin/rg -uu --type-add 'foo: {*,}.foo{_*,}' -tfoo "\D"
and
~/.cargo/bin/rg -uu -g '{*,}.foo{_*,}' "\D"

to output

.foo_baz
1:qwertyuiop

.foo
1:qwertyuiop

bar.foo
1:qwertyuiop

baz.foo_bar
1:qwertyuiop

and for

~/.cargo/bin/rg -uu --type-add 'foo:{*,}.foo{_*,}' -Tfoo --debug "\D"

to output

SHOULD_NOT_BE_GLOBBED
1:qwertyuiop

StaticPH avatar Sep 07 '19 22:09 StaticPH