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

Fix glob pattern to correctly ignore directories with only dots #3019

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pi55man
Copy link

@pi55man pi55man commented Mar 29, 2025

This PR addresses issue #2990, where ripgrep did not properly ignore directories named only with dots (e.g., ., .., ...) when using negated glob patterns (-g '!dir').

Previously, the file_name function in globset only checked if the last byte was a dot (.), which led to incorrect behavior. This caused:

  • rg --files -g '!asdf.' still listing asdf./foo
  • But rg --files -g '!asdf' correctly ignoring asdf/foo

Fix

The function now ensures that entire filenames made only of dots are ignored by using:

if path.iter().all(|&b| b == b'.') {
    return None;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant