Skip to content

refactor: file matching implementation#2566

Open
sinrohit-desco wants to merge 1 commit intomolybdenumsoftware:masterfrom
sinrohit-desco:patch-0
Open

refactor: file matching implementation#2566
sinrohit-desco wants to merge 1 commit intomolybdenumsoftware:masterfrom
sinrohit-desco:patch-0

Conversation

@sinrohit-desco
Copy link
Copy Markdown

Precursor to #1921

Replace hand-rolled Walker iterator and build_ignore_set with
ignore::WalkBuilder from the same ignore crate. Earlier we were using
ignore::gitignore API for pattern matching and a
custom Walker struct for directory traversal. WalkBuilder combines
both — it walks directories and applies gitignore rules.
@mightyiam
Copy link
Copy Markdown
Member

How about we replace most of this with usage of some popular and well tested crate, instead?

@sinrohit-desco
Copy link
Copy Markdown
Author

How about we replace most of this with usage of some popular and well tested crate, instead?

Well, do you have any in mind that we could use?

@mightyiam
Copy link
Copy Markdown
Member

@sinrohit-desco
Copy link
Copy Markdown
Author

Maybe dirwalk - crates.io: Rust Package Registry?

I don't think that this is very good idea. Reasons below

  1. dirwalk is fairly new and has just 89 downloads vs ignore which has downloads in millions and is much more popular and used by ripgrep.
  2. Even dirwalk uses ignore https://codeberg.org/madk/dirwalk/src/branch/main/dirwalk/Cargo.toml#L33
  3. No multiple roots, which means for multiple targets it's not going to be as easy as calling .add() to walk multiple targets in one pass. I'd need separate walks per target, hence losing deduplication.
  4. I used OverrideBuilder to implement --ignore patterns, where as dirwalk has .glob() and .extensions() but no equivalent to the override system that I rely on.

The motivation to use this crate was to simplify things. In my opinion ignore seems much better option but I will let you decide, since you are the maintainer.

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.

2 participants