-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify glob matching #45
Comments
I agree. However, I don't think this is about |
One question is: Does |
It seems our specification is "nearer" to the known behaviour of glob than the c implementation. The implicit expansion with https://en.wikipedia.org/wiki/Glob_(programming) |
For comparision,
If we followed that, glob I looked at editorconfig-core-test.
|
@cxw42 Thanks for the awesome summary -- Now looks like what's unclear in the spec is:
We should make this a bit more formal somehow, but it seems tricky to formulate proper language. I'm thinking maybe it's easier to clarify in the |
Here's an initial draft --- it's not great, so please respond with improvements :) Section names ... accepted by .gitignore.
They support pattern matching through Unix shell-style wildcards.
+
+A section name that does not contain a `/` matches the last component
+of the path at any depth below the EditorConfig file.
+E.g., `[*.py]` matches `foo.py` and `subdir/bar.py`.
+A section name that does contain a `/` matches that section name
+relative to the directory containing that EditorConfig file.
+E.g., `[dir/*.py]` matches `dir/foo.py` but not `dir/subdir/foo.py`.
+
These filepath globs recognize the following as special characters for wildcard matching: (Separately, I realized we should also add tests and spec stating that a section name may not end with a |
The draft looks good to me! |
Taking the specification literally, the glob
*.py
would not matchfoo/bar.py
sincefoo/bar
includes the slash character. The C library for editorconfig adds**/
to the start of the glob if it does not have a slash in it (see editorconfig.c:260), but this should really be in the spec.The text was updated successfully, but these errors were encountered: