Skip to content

worktree: escape files that start with '#' or '!' while ignoring #4446

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

Closed
wants to merge 3 commits into from

Conversation

azarmadr
Copy link

@azarmadr azarmadr commented Apr 1, 2025

  • PR Description

  • Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

fixes #4445

@stefanhaller
Copy link
Collaborator

This looks good, but I wonder if we can take this opportunity to also fix #4075. I imagine we could use a regex that catches all of these (something like ^[!#]|[\[\]\(\)]) and then use ReplaceAllString(filename, "#$1").

@azarmadr
Copy link
Author

azarmadr commented Apr 6, 2025

used string commands only, if that's ok

@stefanhaller
Copy link
Collaborator

used string commands only, if that's ok

But why, using a regex is much less code. Also, I would have expected a bit more research which other characters we need to escape that weren't mentioned in the issue (turns out we also need *), and adding a test would be good.

I found it easier to make these changes myself than to tell you what I would like to have added, so I opened a new PR for this.

Next time you make a PR, please create a branch instead of using the master branch of your fork. This would have allowed my to add these changes directly to your PR, and I wouldn't have had to open a new one.

@stefanhaller
Copy link
Collaborator

This has been addressed by #4475; closing.

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.

ignoring files starting with # will just add a comment
2 participants