Skip to content

Conversation

@HichemTab-tech
Copy link
Owner

Description

This pull request introduces support for .gitignore patterns to the directory tree-building process. Files and directories that match gitignore rules are now excluded or marked as unchecked.

Comprehensive tests for gitignore handling have also been added, ensuring robust pattern parsing, inclusion/exclusion logic, and filesystem integration. These tests improve reliability and prevent regressions by covering utility functions like parseGitignoreContent, matchesGitignorePatterns, and the updated buildTreeNode function.


Checklist

  • My code follows the JetTreeMark-vscode Contribution Guidelines.
  • I have tested the changes locally.
  • I have added or updated necessary documentation (if applicable).
  • I have updated the changelog (if applicable).
  • I have ensured that my changes do not break existing features.

Enhanced the `buildTreeNode` function to account for `.gitignore` patterns when generating directory trees. This ensures files and directories that match gitignore rules are excluded or marked as unchecked.

- Added `collectDirectoryGitignorePatterns` and `shouldExcludeByGitignore` utility functions.
- Updated `buildTreeNode` to handle gitignore patterns and pass them recursively.
- Adjusted logic to mark files/folders as unchecked if excluded by gitignore rules.
Introduce unit and integration tests to validate gitignore utility functions, ensuring proper parsing, matching, and exclusion logic. These tests improve code reliability and prevent regressions.

- Added tests for `parseGitignoreContent` to verify pattern parsing.
- Tested `matchesGitignorePatterns` to validate inclusion/exclusion logic.
- Implemented integration tests to check filesystem interactions.
- Verified `collectGitignorePatterns` and `shouldExcludeByGitignore` behaviors.
- Confirmed `buildTreeNode` respects gitignore patterns accurately.
@HichemTab-tech HichemTab-tech self-assigned this May 3, 2025
@HichemTab-tech HichemTab-tech merged commit 052d208 into master May 3, 2025
4 checks passed
@HichemTab-tech HichemTab-tech deleted the remove-files-mentionned-in-gitignore-by-default branch May 3, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants