Use the contents of .git/info/exclude when useGitignore is set to true. Fixes #375#391
Conversation
📝 WalkthroughWalkthroughThe pull request enhances the Sequence Diagram(s)sequenceDiagram
participant FS as getIgnorePatterns
participant CFG as Configuration
participant FSYS as File System
participant LOGGER as Logger
FS->>CFG: Check useGitignore option
alt useGitignore is true
FS->>FSYS: Construct .git/info/exclude path and read file
alt File read is successful
FSYS-->>FS: Return file content
FS->>FS: Parse content and add patterns
else File read fails
FSYS-->>FS: Return error or no content
FS->>LOGGER: Log trace message
end
else useGitignore is false
FS->>FS: Proceed without .git/info/exclude patterns
end
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
PR Overview
This PR implements the feature to include patterns from the .git/info/exclude file when the useGitignore configuration is enabled.
- Added a new test case in tests/core/file/fileSearch.test.ts to verify that patterns in .git/info/exclude are correctly considered.
- Extended getIgnorePatterns in src/core/file/fileSearch.ts to read and include exclude file patterns.
Reviewed Changes
| File | Description |
|---|---|
| tests/core/file/fileSearch.test.ts | Added a test to confirm that exclude file patterns are applied when useGitignore is true. |
| src/core/file/fileSearch.ts | Added functionality to read .git/info/exclude and include its patterns based on configuration. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #391 +/- ##
==========================================
+ Coverage 90.17% 90.21% +0.03%
==========================================
Files 72 72
Lines 3472 3484 +12
Branches 750 755 +5
==========================================
+ Hits 3131 3143 +12
Misses 341 341 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7e0d28c to
0c8fbb0
Compare
There was a problem hiding this comment.
PR Overview
This PR implements support for reading ignore patterns from the .git/info/exclude file when the useGitignore configuration option is enabled, addressing issue #375.
- Added functionality in fileSearch.ts to load and parse the .git/info/exclude file.
- Introduced a new test in fileSearch.test.ts to verify that the exclude file patterns are correctly included.
Reviewed Changes
| File | Description |
|---|---|
| tests/core/file/fileSearch.test.ts | Added tests to validate the .git/info/exclude file support. |
| src/core/file/fileSearch.ts | Implemented reading and parsing of .git/info/exclude file. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
tests/core/file/fileSearch.test.ts:165
- [nitpick] Using 'endsWith' to compare paths can lead to false positives if part of the file path matches. Consider comparing resolved absolute paths for a more robust check.
if (filePath.toString().endsWith(excludePath)) {
|
@motlin I'll go ahead and merge this, then include it in the next release! If you have any other ideas or suggestions, please feel free to reach out! |
Checklist
npm run testnpm run lint