Skip to content

v0.1#1

Open
aldanor wants to merge 59 commits intomainfrom
v0
Open

v0.1#1
aldanor wants to merge 59 commits intomainfrom
v0

Conversation

@aldanor
Copy link
Owner

@aldanor aldanor commented May 20, 2025

This PR (and this crate) are made specifically for being used in uv cache-key globbing but may be useful for general public as well in cases where globwalk doesn't quite cover it.

Initial version that should pretty much fully work (as much as I've tested).

It also has different edge cases than walkdir (e.g. avoiding duplicates may require canonicalization, because of allowing relative/abs paths), etc.

What it does - given a base path and a list of patterns, constructs tries and globsets at its vertices and tries to walk it in an efficient way without walking the same folder twice (as opposed to "walk everything, then filter"). Relative and absolute paths are also supported. AFAIK, there's no current easy solutions to this.

Why not globwalk? (currently used in uv)

  • It doesn't support relative or absolute paths, only walks within a single root
  • It's not efficient in globbing - e.g. given foo/bar/** glob it will still walk over the entirety of the base folder (there's unmerged PRs attempting to partially patch that)
  • It not maintained and its author recommends switching to other libs in the readme; there's some bugs/panics reported and not fixed for a long time

Notes:

  • crate-level docs and readme will be added before pushing a release; the rest of docstrings should already be there. I'm holding off on that waiting for some reviews first
  • there's no .gitignore support (but there's none in globwalk either); can be probably added post-factum if need be (doing it via .skip_entry() will be more complicated though than doing post-filtering just before returning results)

@BurntSushi this is based on two of yours crates (thanks for that) and some code had to be borrowed from walkdir - there's a few mentions of that in the code with notes/credits.

(Random note: windows tests were a pain, had to cross compile them to wine to debug.)

@aldanor aldanor force-pushed the v0 branch 2 times, most recently from b17620f to 11e83e3 Compare May 27, 2025 01:25
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

Comments