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

globset: fix recursive suffix over matching #1756

Closed
wants to merge 1 commit into from
Closed

globset: fix recursive suffix over matching #1756

wants to merge 1 commit into from

Conversation

zertosh
Copy link
Contributor

@zertosh zertosh commented Dec 8, 2020

The syntax documentation correctly states how recursive suffixes should
behave:

** recursively matches directories [..] foo/** matches foo/a and
foo/a/b, but not foo.

Previously ** would actually match foo. This patch makes it so that
it doesn't. Also adds support to the "prefix" strategic matcher so that
it handles common cases like foo/**.

Copy link
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thank you!

@BurntSushi BurntSushi added the rollup A PR that has been merged with many others in a rollup. label May 31, 2021
BurntSushi pushed a commit that referenced this pull request May 31, 2021
Previous, 'foo/**' would match 'foo', but it shouldn't have. In this
case, not matching 'foo' is what is documented and also seems consistent
with other recursive globbing implementations (like that in zsh).

This also updates the prefix extractor to pull 'foo/' out of 'foo/**'.

Closes #1756
BurntSushi pushed a commit that referenced this pull request Jun 1, 2021
Previous, 'foo/**' would match 'foo', but it shouldn't have. In this
case, not matching 'foo' is what is documented and also seems consistent
with other recursive globbing implementations (like that in zsh).

This also updates the prefix extractor to pull 'foo/' out of 'foo/**'.

Closes #1756
@BurntSushi BurntSushi closed this in 7534d51 Jun 1, 2021
@zertosh zertosh deleted the fix_recursive_suffix branch June 1, 2021 01:55
facebook-github-bot pushed a commit to facebookincubator/reindeer that referenced this pull request Jun 15, 2021
Summary:
The only real change here is: BurntSushi/ripgrep#1756
This is a patch release but fixes a very glaring bug that others have
depended on. This diff fixes the uses to match the old behavior.

Although it's billed as a "fix", it's actually a huge perf improvement
for Linttool, which uses predominantly recursive suffix globs. The fact
that we don't have to compile ~5,000 regexps at Linttool startup anymore
makes such a huge difference that I am going to do write up soon.

Reviewed By: ndmitchell

Differential Revision: D29085977

fbshipit-source-id: 304470e5fa8cb986738aa0d9dd941641684a9194
facebook-github-bot pushed a commit to facebook/sapling that referenced this pull request Jun 15, 2021
Summary:
The only real change here is: BurntSushi/ripgrep#1756
This is a patch release but fixes a very glaring bug that others have
depended on. This diff fixes the uses to match the old behavior.

Although it's billed as a "fix", it's actually a huge perf improvement
for Linttool, which uses predominantly recursive suffix globs. The fact
that we don't have to compile ~5,000 regexps at Linttool startup anymore
makes such a huge difference that I am going to do write up soon.

Reviewed By: ndmitchell

Differential Revision: D29085977

fbshipit-source-id: 304470e5fa8cb986738aa0d9dd941641684a9194
passcod added a commit to watchexec/watchexec that referenced this pull request Jul 10, 2021
Breakage caused by this fix: BurntSushi/ripgrep#1756

The fix is correct, but it does break a lot of stuff :/
@passcod
Copy link

passcod commented Jul 10, 2021

Even though I agree this is a fix as per documentation, perhaps it should have been a semver bump? It changed behaviour (and broke my tests)...

@BurntSushi
Copy link
Owner

Perhaps. But in this case, this is bringing the implementation in line with documented behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR that has been merged with many others in a rollup.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants