uv/crates/uv-globfilter
Ben Beasley 80ab562f9f
In uv-globfilter, use the workspace fs-err in dev-dependencies (#9262)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

In uv-globfilter, use the workspace `fs-err` in `dev-dependencies`.

This fixes an unnecessary dev-dependency on `fs-err` 2.x even after the
workspace fs-err was updated to 3.x in
https://github.com/astral-sh/uv/pull/8625.

The `Cargo.lock` file still has `fs-err v2.11.0` after this PR, but it
is via `tracing-durations-export v0.3.0` rather than directly required
by any `uv` crate.

## Test Plan

<!-- How was it tested? -->

```
$ cd crates/uv-globfilter/
$ cargo test
```
2024-11-20 03:59:37 +00:00
..
src Build backend: Add source tree -> source dist -> wheel tests (#9091) 2024-11-14 19:15:32 +00:00
Cargo.toml In uv-globfilter, use the workspace fs-err in dev-dependencies (#9262) 2024-11-20 03:59:37 +00:00
README.md Build backend: Switch to custom glob-walkdir implementation (#9013) 2024-11-14 13:14:58 +00:00

README.md

globfilter

Portable directory walking with includes and excludes.

Motivating example: You want to allow the user to select paths within a project.

include = ["src", "License.txt", "resources/icons/*.svg"]
exclude = ["target", "/dist", ".cache", "*.tmp"]

When traversing the directory, you can use GlobDirFilter::from_globs(...)?.match_directory(&relative) skip directories that never match in WalkDirs filter_entry.

Syntax

This crate supports the cross-language, restricted glob syntax from PEP 639:

  • Alphanumeric characters, underscores (_), hyphens (-) and dots (.) are matched verbatim.
  • The special glob characters are:
    • *: Matches any number of characters except path separators
    • ?: Matches a single character except the path separator
    • **: Matches any number of characters including path separators
    • [], containing only the verbatim matched characters: Matches a single of the characters contained. Within [...], the hyphen indicates a locale-agnostic range (e.g. a-z, order based on Unicode code points). Hyphens at the start or end are matched literally.
  • The path separator is the forward slash character (/). Patterns are relative to the given directory, a leading slash character for absolute paths is not supported.
  • Parent directory indicators (..) are not allowed.

These rules mean that matching the backslash (\) is forbidden, which avoid collisions with the windows path separator.