-
Notifications
You must be signed in to change notification settings - Fork 0
chore: ignore git directories #24
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
Conversation
There was a problem hiding this 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 adds logic to exclude .git directories from language detection during cache directory scanning. Instead of attempting to detect a language for .git directories, they will be explicitly assigned an empty language string rather than "no language found".
Key Changes
- Introduced an
excludedFromLanguageDetectionlist containing.gitdirectories - Added tracking for excluded directories via
excludedDirsmap - Modified language detection logic to skip excluded directories and set their language to empty string
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dev-cache/main.go
Outdated
| if isExcluded && depth == 0 { | ||
| excludedDirs[projectRoot] = true | ||
| langCache[projectRoot] = "" // Explicitly set to empty, not "no language found" | ||
| detectedLang = "" | ||
| // Skip all language detection for this directory | ||
| } | ||
|
|
||
| // Check cache first for project root | ||
| if cachedLang, ok := langCache[projectRoot]; ok { |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting langCache[projectRoot] to empty string at line 577, then immediately checking the cache at line 583 will find that empty string. This means detectedLang gets reassigned from the value set at line 578. While both are empty strings so the outcome is the same, this creates confusing control flow. Consider restructuring to either skip the cache check when isExcluded is true, or move the excluded directory handling after the cache check.
dev-cache/main.go
Outdated
| } | ||
| } else if projectRoot != "" { | ||
| // Detect language at project root and cache result | ||
| } else if projectRoot != "" && !isExcluded { |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isExcluded check is performed multiple times (lines 575, 589, 603, 616) but only applies when depth == 0 based on line 575. Consider combining the depth check with isExcluded into a single variable like shouldSkipDetection := isExcluded && depth == 0 to avoid redundant checks at deeper levels where exclusion doesn't apply.
2a72932 to
bc8af7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…g scanned is excluded, not just whether the current path's name matches the exclusion pattern.
Created a global exclude directory path that will always return null for cache type.
This change updates
dev-cache/main.goto exclude git directories from cache operations.