Skip to content

glob matching doesn't seem to work consistenly for plain directory match #1442

@w08r

Description

@w08r

What version of ripgrep are you using?

▶ rg --version                                                                                                                                                                    
ripgrep 11.0.1
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

Compiled from source

What operating system are you using ripgrep on?

MacOS (Catalina)

Describe your question, feature request, or bug.

I think that passing a plain directory as argument to -g should match files in that directory. Moreover, prefixing a match string with ! should negate the results. This seems to the behaviour most of the time.

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

## from temp, empty directory
mkdir a b
echo hello > a/test.txt
cp a/test.txt b
rg -g a hello ## return nothing
rg -g '!b' hello ## returns match from file in 'a'

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

Above script yields following (showing output of negated search only)

▶ sh /tmp/run.sh                                                                                                                                                                  
a/test.txt
1:hello

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

Should have yielded results for either both or neither (preferably both) the invocations in the reproduction steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docAn issue with or an improvement to documentation.rollupA PR that has been merged with many others in a rollup.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions