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

Parsing of .gitignore files doesn't match git, causing cmd+p to not find any files #202118

Open
verhovsky opened this issue Jan 10, 2024 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member search Search widget and operation issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Milestone

Comments

@verhovsky
Copy link

verhovsky commented Jan 10, 2024

Does this issue occur when all extensions are disabled?: Yes

VS Code Version:

Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:48:16.874Z (3 wks ago)
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.2.0

Steps to Reproduce:

Simple:

git clone https://github.com/gskinner/regexr.git
cd regexr
git checkout 1e382719041f8b1e5290472e14e2c98a6c05b61a
code .

and then Press Cmd+p and type in any of the file names you see.

Manually:

  1. Create a new directory
  2. git init
  3. create some files and commit them
  4. add the following .gitignore:
#-----------------------------
# INVALID FILES
# (for cross OS compatibility)
#-----------------------------
*[\<\>\:\"\/\\\|\?\*]*
  1. commit it
  2. Open the project in VS Code to search for any of the files you created with Cmd+P

It will not find any files unless you have them open in the editor already.

Screenshot 2024-01-09 at 20 50 59

Removing the line and saving causes files to be found again

Screenshot 2024-01-09 at 20 52 08

I found this regex in a project I cloned and it seems that git must parse it differently because obviously git is not ignoring all the files.

This issue is a follow up to #48771

@verhovsky verhovsky changed the title Bad regex parsing in .gitignore files causing files to no longer be found Parsing of .gitignore files doesn't match git, causing cmd+p to not find any files Jan 10, 2024
@lszomoru
Copy link
Member

Adding @roblourens as he worked on the mentioned issue.

@roblourens roblourens assigned andreamah and unassigned roblourens and lszomoru Jan 23, 2024
@roblourens
Copy link
Member

Interesting, it seems like matching / is actually matching a path separator, so anything under a folder is ignored, when it doesn't work that way in git.

@andreamah you could verify that I'm right and check that rg on its own does the same, and file an issue upstream.

@andreamah
Copy link
Contributor

Confirmed that it happens in my WSL on the newest rg version, filed BurntSushi/ripgrep#2745 with ripgrep

@andreamah andreamah added bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member search Search widget and operation issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Mar 1, 2024
@andreamah andreamah added this to the Backlog milestone Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member search Search widget and operation issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants