Skip to content

Whitelisting via .gitignore does not handle dot prefix ("!./fname") #1374

@blueyed

Description

@blueyed

Given a .gitignore file:

*
!./PKGBUILD

rg will skip the PKGBUILD file:

DEBUG|ignore::walk|ignore/src/walk.rs:1639: ignoring ./PKGBUILD: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("./.gitignore"), original: "", actual: "**/", is_whitelist: false, is_only_dir: false })))

This appears to be due to the leading dot there.
Git handles this as expected.

Removing the dot (using !/PKGBUILD) whitelists it then:

DEBUG|ignore::walk|ignore/src/walk.rs:1642: whitelisting ./PKGBUILD: Whitelist(IgnoreMatch(Gitignore(Glob { from: Some("./.gitignore"), original: "!/PKGBUILD", actual: "PKGBUILD", is_whitelist: true, is_only_dir: false })))

What version of ripgrep are you using?

ripgrep 11.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    gitignoreBugs related to gitignore problems.invalidAn issue that is not actually a bug or a feature that already exists.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions