Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**/**/* does not match a/foo.rs (instead, it will only ever match an absolute path) #1174

Closed
BurntSushi opened this issue Jan 23, 2019 · 0 comments
Labels
bug A bug.

Comments

@BurntSushi
Copy link
Owner

Originally reported by @okdana in #1093 (comment)

What version of ripgrep are you using?

master @ b48bbf5

How did you install ripgrep?

Compiled.

What operating system are you using ripgrep on?

Linux.

Describe your question, feature request, or bug.

The **/**/* pattern does not match a/foo.rs while git does. Similarly for **/**/**/* and so on.

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

$ mkdir /tmp/rgbug
$ cd /tmp/rgbug
$ git init
$ echo '**/**/*' > .gitignore
$ mkdir a
$ echo test > a/foo
$ rg test
foo
1:test

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

foo is shown as a search result, but it should be ignored. The output of --debug shows this line:

DEBUG|globset|globset/src/lib.rs:424: glob converted to regex: Glob { glob: "**/**/*", re: "(?-u)^(?:/|/.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true }, tokens: Tokens([RecursiveZeroOrMore, ZeroOrMore]) }

The glob-to-regex conversion here appears wrong, since (?-u)^(?:/|/.*/)[^/]*$ can only ever match paths that start with a /.

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

foo should have been ignored by the **/**/* pattern.

@BurntSushi BurntSushi added the bug A bug. label Jan 23, 2019
BurntSushi added a commit that referenced this issue Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

No branches or pull requests

1 participant