When attempting to exclude a file with square brackets or parenthesis in the file path, LazyGit appends the path to .git/info/exclude without escaping the special characters. This causes the exclusion not to work as Git interprets square brackets as part of a regular expression pattern.
To Reproduce
Steps to reproduce the behavior:
Open LazyGit in a Next.js project.
Navigate to a file with a path that includes square brackets or parenthesis e.g., src/app/(fullscreen)/dashboard/screening/campaigns/[campaignId]/page.ts
Use LazyGit to exclude the file.
Check .git/info/exclude to see the appended path.
Expected behavior
The file path should be escaped properly in .git/info/exclude, ensuring that special characters such as square brackets ([ ]) are treated literally. For example:
Describe the bug
When attempting to exclude a file with square brackets or parenthesis in the file path, LazyGit appends the path to .git/info/exclude without escaping the special characters. This causes the exclusion not to work as Git interprets square brackets as part of a regular expression pattern.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The file path should be escaped properly in .git/info/exclude, ensuring that special characters such as square brackets ([ ]) are treated literally. For example:
Screenshots
N/A
Desktop (please complete the following information):
Additional context
N/A