Skip to content

Use a path that is a file as it is, and only glob the rest, to close #718 - #750

Merged
mathiasrw merged 6 commits into
mainfrom
fix/718
Oct 23, 2026
Merged

mathiasrw merged 6 commits into
mainfrom
fix/718

Conversation

@mathiasrw

@mathiasrw mathiasrw commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #718

Stacked on #749. Merge that first.

Change

How the files are found, in this order:

  1. A: each path given that is a file is used as it is, so a name with glob characters, like a[1].md, my (1).md or [id].tsx, gives only that file. The other paths are globbed together, so a glob that starts with ! still takes files away from the other globs.
  2. With --absolute-path each file is known by its full path from here on.
  3. B: all --exclude-glob (-X) values are globbed together as one group. They are always globs, also when one is the name of a file, so ! can be used in them too.
  4. B is taken away from A. The files are compared by their full path, so ./a.md and a.md are the same file.
  5. Last, --exclude-re (-x) takes away every file with a path that matches. With --absolute-path that is the full path.
  6. The files are sorted.

A file that is found in more than one way is only handled once.

Tests

  • test/js/fix/718.test.js tests each name in the table of the issue, a file in a folder, and how a path to a file works together with globs, a ! glob, --exclude-glob (always a glob, escaped, one group with !) and --exclude-re (also on the full path with --absolute-path).
  • test/cli/run.sh tests the same through the CLI.

Good to know

  • A ! glob does not take away a file given by its path, as that file is not a glob. Today a.md '!a.md' gives no file. Now it gives a.md. Use -X or -x to leave it out.
  • -X is globs only, never files, so -X 'a[1].md' also leaves out a1.md.
  • If a file is named *.md, then '*.md' gives only that file and no longer all markdown files. This is in the issue.
  • Two old bugs are fixed with the full path compare: a file given with a relative and an absolute path was handled two times, and -X 'docs/a*' did not leave out ./docs/a.md.
  • The README explains this under Good to know, and the help of -x and -X is updated.

@mathiasrw
mathiasrw added this pull request to stack #765 October 23, 2026 00:30
@mathiasrw
mathiasrw force-pushed the fix/718 branch 3 times, most recently from 8216bc8 to 991ac59 Compare October 23, 2026 00:36
Base automatically changed from fix/689 to main October 23, 2026 00:43
@mathiasrw
mathiasrw merged commit f38964b into main Oct 23, 2026
7 checks passed
@mathiasrw
mathiasrw deleted the fix/718 branch October 23, 2026 01:11
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.

A file with glob characters in its name is not found, or other files are changed with it

1 participant