-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat(ignore): add .stignore escaping on Windows #10058
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
Conversation
Fixes syncthing#10057 Based on the discussion in https://forum.syncthing.net/t/towards-syncthing-2-0/24072/35 This PR adds the ability for Windows users to use the pipe character (|) to escape the metacharacters *, ?, [, and { in .stignore files. Additionally, this PR adds the ability for the user to set the escape character to backslash, or any character they want, by adding a line in the form: #escape=X (where X is any single rune), to the top of the .stginore file. This would allow users to use the same .stignore files across platforms, by simply adding #escape=\ to their files.
Co-authored-by: Jakob Borg <jakob@kastelo.net>
Do we also want to require having at most a single |
@calmh That seems entirely reasonable. I can't imagine a use case where they need to redefine it, or define it mid-file. I'll make it so. |
Are there any considerations for includes? The setting is per file, right, with no infectiousness between files? |
@calmh Good question. Requiring the user to add it to each file is simpler, and won't surprise the user if they don't read the docs. But we could add a config option to change the default escape char for Windows users, if we want. Lemme know. |
Let's not. I think it's better to account for ignore files being synced between different devices and make sure they're always interpreted the same based on just their content. |
Draft documentation is at https://github.com/rasa/docs/blob/rasa-add-stignore-escaping/users/ignoring.rst#patterns |
578cad6
to
43d33db
Compare
@calmh The errors in the logs were intermittent:
After merging main onto this branch, the latest run succeeded. So please reconsider this PR, or let me know if there's anything I can do to improve it for reconsideration. Thanks. |
@calmh This was closed without a comment. It was closed at the same time the v2 branch was deleted, so did it get closed automatically or accidentally? |
Oh, accidentally. Repoint at main. That's what GitHub does when the target branch disappears, sorry. |
@calmh No worries. The [Reopen and comment] button is grayed out for me. If you reopen, I will fix it. Or should I submit a new PR instead? |
Same for me. |
Ref syncthing/syncthing#10058 --------- Co-authored-by: tomasz1986 <twilczynski@naver.com>
Fixes #10057: Support escaping in .stignore files on Windows
Fixes #7547: Ignore pattern with \[ and \] does not work
Purpose
Based on the discussion in
https://forum.syncthing.net/t/towards-syncthing-2-0/24072/35
this PR adds the ability for Windows users to use the pipe character (
|
) to escape the metacharacters*
,?
,[
, and{
in .stignore files.Additionally, this PR adds the ability for the user to set the escape character to backslash, or any character they want, by adding a line in the form:
#escape=X
(where X is any single rune), to the top of the .stginore file.
This would allow users to use the same .stignore files across platforms, by simply adding
#escape=\
to their files.
edit: Of course, when a Windows user does this, they will need replace any backslashes with forward slashes, so
would become:
Testing
Tested on Ubuntu and Windows 11.
Documentation
I'll submit a PR to update the docs if this is accepted.