fileset docs: edits to quoting and file pattern instructions

- Swapped `file:"path"` and `cwd-file:"path"` for consistency with the first line

- Created a labeled section for quoting rules

- Elaborated on the quoting rules in the beginning of file pattern section.
This commit is contained in:
Ilya Grigoriev 2025-03-08 22:25:26 -08:00
parent fe9e71b90e
commit bc06e66313

View File

@ -5,6 +5,8 @@ Expressions in this language are called "filesets" (the idea comes from
[Mercurial](https://repo.mercurial-scm.org/hg/help/filesets)). The language [Mercurial](https://repo.mercurial-scm.org/hg/help/filesets)). The language
consists of file patterns, operators, and functions. consists of file patterns, operators, and functions.
## Quoting file names
Many `jj` commands accept fileset expressions as positional arguments. File Many `jj` commands accept fileset expressions as positional arguments. File
names passed to these commands [must be quoted][string-literals] if they contain names passed to these commands [must be quoted][string-literals] if they contain
whitespace or meta characters. However, as a special case, quotes can be omitted whitespace or meta characters. However, as a special case, quotes can be omitted
@ -23,12 +25,14 @@ required:
## File patterns ## File patterns
The following patterns are supported: The following patterns are supported. In all cases, we do not mention any shell
quoting that might be necessary, and the quotes around `"path"` are optional if
the path [has no special characters](#quoting-file-names).
* `"path"`, `path` (the quotes are optional), or `cwd:"path"`: Matches * `"path"` or `cwd:"path"`: Matches cwd-relative path prefix (file or files
cwd-relative path prefix (file or files under directory recursively.) under directory recursively.)
* `cwd-file:"path"` or `file:"path"`: Matches cwd-relative file (or exact) path. * `file:"path"` or `cwd-file:"path"`: Matches cwd-relative file (or exact) path.
* `cwd-glob:"pattern"` or `glob:"pattern"`: Matches file paths with cwd-relative * `glob:"pattern"` or `cwd-glob:"pattern"`: Matches file paths with cwd-relative
Unix-style shell [wildcard `pattern`][glob]. For example, `glob:"*.c"` will Unix-style shell [wildcard `pattern`][glob]. For example, `glob:"*.c"` will
match all `.c` files in the current working directory non-recursively. match all `.c` files in the current working directory non-recursively.
* `root:"path"`: Matches workspace-relative path prefix (file or files under * `root:"path"`: Matches workspace-relative path prefix (file or files under