From aec09cd3874180a90b01ff098bb1773f0cc7d4dc Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Tue, 18 Jun 2024 14:27:18 -0700 Subject: [PATCH 1/2] Clarify the effects of path separator This is consistent with the rules from `.gitignore`: > If there is a separator at the beginning or middle (or both) of the > pattern, then the pattern is relative to the directory level of the > particular .gitignore file itself. Otherwise the pattern may also match > at any level below the .gitignore level. Since we intend to be consistent with `.gitignore`, this part of the spec has been unclear. Fix editorconfig/editorconfig#509 --- index.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.rst b/index.rst index 74f1120..9d1ff22 100644 --- a/index.rst +++ b/index.rst @@ -160,6 +160,13 @@ special characters for wildcard matching: - any integer numbers between ``num1`` and ``num2``, where ``num1`` and ``num2`` can be either positive or negative +If there is a path separator (``/``) at in the glob, then the glob is relative +to the directory level of the particular `.editorconfig` file itself. +Otherwise the pattern may also match at any level below the `.editorconfig` +level. For example, ``*.c`` matches any file that ends with ``.c`` in the +directory of ``.editorconfig``, but ``subdir/*.c`` only matches files that end +with ``.c`` in the ``subdir`` directory in the directory of ``.editorconfig``. + The backslash character (``\\``) can be used to escape a character so it is not interpreted as a special character. From a743fc731ed97f2cac493591ce065db839787e89 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Sun, 15 Sep 2024 18:27:09 -0700 Subject: [PATCH 2/2] Update index.rst Co-authored-by: Chris White --- index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.rst b/index.rst index 9d1ff22..749bdab 100644 --- a/index.rst +++ b/index.rst @@ -160,7 +160,7 @@ special characters for wildcard matching: - any integer numbers between ``num1`` and ``num2``, where ``num1`` and ``num2`` can be either positive or negative -If there is a path separator (``/``) at in the glob, then the glob is relative +If the glob contains a path separator (a ``/`` not inside square brackets), then the glob is relative to the directory level of the particular `.editorconfig` file itself. Otherwise the pattern may also match at any level below the `.editorconfig` level. For example, ``*.c`` matches any file that ends with ``.c`` in the