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

Add option to not pass --no-ignore-parent to rg #140022

Merged
merged 1 commit into from
Jan 4, 2022
Merged

Add option to not pass --no-ignore-parent to rg #140022

merged 1 commit into from
Jan 4, 2022

Conversation

samestep
Copy link
Contributor

@samestep samestep commented Jan 3, 2022

@roblourens This PR fixes #118229. You can test it using these steps:

  1. Create the following directory structure:
    foo
    ├── bar
    │   └── baz.txt
    └── .gitignore
    
  2. In foo/, run the following command:
    git init
  3. Put the following contents in foo/.gitignore:
    baz.txt
  4. Put the following contents in foo/bar/baz.txt:
    qux
    
  5. Build and run this PR.
  6. Open the folder foo/bar/.
  7. Run the command Go to File... (Ctrl+P on Linux). Type in baz: the file baz.txt should appear.
  8. In the Search sidebar (Ctrl+Shift+F on Linux), type in qux: its appearance in baz.txt should appear.
  9. If you opened baz.txt in VS Code in step 7 or 8, run Go to File... again and click the "X" next to baz.txt (it would say "recently opened" in that case).
  10. Run the command Preferences: Open Settings (UI) (Ctrl+, on Linux). Type "ignore" in the search bar, then enable the setting Search: Use Parent Ignore Files.
  11. Repeat steps 7 and 8: nothing should appear.

I wrote this by piggybacking off of #59717: I searched for the string GlobalIgnoreFiles in the codebase and added similar code for ParentIgnoreFiles alongside each occurrence I found. Please let me know if I missed anything, or if I should add any automated tests to accompany the code changes.

@ghost
Copy link

ghost commented Jan 3, 2022

CLA assistant check
All CLA requirements met.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks

@roblourens roblourens merged commit d707444 into microsoft:main Jan 4, 2022
@samestep samestep deleted the use-parent-ignore-files branch January 4, 2022 01:08
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Performance improvement] Add an option to use parent folder .gitignore during search
2 participants