Skip to content

Limit search pattern and directory recursion #4647

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

Merged
merged 1 commit into from
Aug 9, 2025

Conversation

asbjornu
Copy link
Member

@asbjornu asbjornu commented Aug 8, 2025

Description

Narrow the scope of the search pattern to only include project files and limit directory recursion to 255 subdirectories to avoid infinite loops and subsequent PathTooLongException.

Related Issue

May fix GH-4411.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 23:10
@asbjornu asbjornu added this to the 6.x milestone Aug 8, 2025
Copilot

This comment was marked as outdated.

@asbjornu asbjornu force-pushed the gh-4411-enumerate-files branch 2 times, most recently from da62f4a to 86ca875 Compare August 8, 2025 23:13
@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:14
@asbjornu asbjornu assigned arturcic and unassigned arturcic Aug 8, 2025
Copilot

This comment was marked as outdated.

@asbjornu asbjornu requested a review from arturcic August 8, 2025 23:14
@asbjornu asbjornu force-pushed the gh-4411-enumerate-files branch from 86ca875 to 3693ec5 Compare August 8, 2025 23:16
@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:16
Copilot

This comment was marked as outdated.

@asbjornu asbjornu requested a review from Copilot August 8, 2025 23:20
Copilot

This comment was marked as outdated.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the project file discovery mechanism by limiting the scope and depth of directory traversal to prevent infinite loops and PathTooLongException errors. The changes specifically target scenarios where directory recursion could become problematic.

  • Introduces a maximum recursion depth limit of 255 subdirectories
  • Narrows the search pattern from "*" to "*proj" to focus on actual project files
  • Replaces the legacy SearchOption.AllDirectories with modern EnumerationOptions

Narrow the scope of the search pattern to only include project files and
limit directory recursion to 255 subdirectories to avoid infinite loops
and subsequent `PathTooLongException`. May fix GitToolsGH-4411.
@arturcic arturcic force-pushed the gh-4411-enumerate-files branch from f37a27d to b857ada Compare August 9, 2025 19:09
Copy link

sonarqubecloud bot commented Aug 9, 2025

@arturcic arturcic enabled auto-merge August 9, 2025 19:14
@arturcic arturcic merged commit d145da0 into GitTools:main Aug 9, 2025
85 checks passed
Copy link
Contributor

mergify bot commented Aug 9, 2025

Thank you @asbjornu for your contribution!

@arturcic arturcic modified the milestones: 6.x, 6.4.0 Aug 9, 2025
@gittools-bot
Copy link

🎉 This issue has been resolved in version 6.4.0 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ISSUE]: Recursing symlinks infinitely - PathTooLongException
3 participants