Skip to content

deep option behaves differently from fast-glob #158

@outslept

Description

@outslept

tinyglobby produces different results than fast-glob for some patterns when deep is set. Reproducible on win10 and archlinux (via WSL).

  1. My branch - https://github.com/outslept/tinyglobby/tree/fix/deep-option
  2. Test file - https://github.com/outslept/tinyglobby/blob/fix/deep-option/test/deep.test.mjs

Globstar with deep = 1 returns extra files compared to fast-glob.
Parent-directory patterns (../**/*.txt) miss matches compared to fast-glob.

Thoughts:

  • normalizePattern moves the root up, but the processed match stays relative to the original cwd (i.e., it still contains the ../ prefix). The walker crawls from root=parent (producing paths like child/deep.txt), while the matcher expects paths relative to cwd (../child/deep.txt). That mismatch (root vs cwd) leads to no matches.
  • The calculatedMaxDepth looks correct in logs, so it shouldn't be an arithmetic issue I guess

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions