Skip to content
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

Special characters are not escaped when excluding files #4075

Open
Armadillidiid opened this issue Nov 25, 2024 · 3 comments
Open

Special characters are not escaped when excluding files #4075

Armadillidiid opened this issue Nov 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Armadillidiid
Copy link

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:

  1. Open LazyGit in a Next.js project.
    
  2. Navigate to a file with a path that includes square brackets or parenthesis e.g., src/app/(fullscreen)/dashboard/screening/campaigns/[campaignId]/page.ts
    
  3. Use LazyGit to exclude the file.
    
  4. 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:

src/app/\(fullscreen\)/dashboard/screening/campaigns/\[campaignId\]/page..ts

Screenshots

N/A

Desktop (please complete the following information):

OS: [Your OS, e.g., Ubuntu 22.04]
Lazygit Version: commit=v0.44.1, build date=2024-09-18T13:19:48Z, build source=binaryRelease, version=0.44.1, os=linux, arch=amd64, git version=2.47.0
Git Version:  2.47.0

Additional context

N/A

@Armadillidiid Armadillidiid added the bug Something isn't working label Nov 25, 2024
@GhostFire90
Copy link

GhostFire90 commented Nov 25, 2024

Before i fork to work on this could you show the current behavior? Just to make sure i understand

@mark2185
Copy link
Collaborator

mark2185 commented Nov 25, 2024

Instead of escaping characters, could the entire path just be quoted?

EDIT: looks like it can't.

@Armadillidiid
Copy link
Author

Instead of escaping characters, could the entire path just be quoted?

EDIT: looks like it can't.

There's no other way around it? I would like to work on this but I don't sadly write Go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants