Skip to content

fix: show glob-specific error for path separators in --glob patterns (fixes #1720)#2017

Open
wyf027 wants to merge 1 commit into
sharkdp:masterfrom
wyf027:fix/glob-path-separator-hint-1720
Open

fix: show glob-specific error for path separators in --glob patterns (fixes #1720)#2017
wyf027 wants to merge 1 commit into
sharkdp:masterfrom
wyf027:fix/glob-path-separator-hint-1720

Conversation

@wyf027

@wyf027 wyf027 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When --glob is used with a pattern containing /, show a glob-specific error message
  • Points users to --glob --full-path for matching against full paths

Motivation

Fixes #1720. The existing path-separator diagnostic is regex-oriented; glob users benefit from guidance that mentions --glob --full-path explicitly.

Example

$ fd --glob 'foo/*.rs'
[fd error]: The glob pattern 'foo/*.rs' contains a path separator.

By default, `fd --glob` matches file names only, not directory paths. To match against the full path, use:

  fd --glob --full-path 'foo/*.rs'

Test plan

  • cargo test test_glob_pattern_with_forward_slash_is_rejected

When --glob is used with a pattern containing '/', show guidance to use
--glob --full-path instead of the generic regex-oriented diagnostic.

Fixes sharkdp#1720

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

--glob | Add warning and fast exit when / in pattern

1 participant