Skip to content

Conversation

@markcallen
Copy link
Owner

Created a global exclude directory path that will always return null for cache type.

This change updates dev-cache/main.go to exclude git directories from cache operations.

@markcallen markcallen linked an issue Nov 27, 2025 that may be closed by this pull request
@markcallen markcallen requested a review from Copilot November 27, 2025 04:27
Copy link
Contributor

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 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 excludedFromLanguageDetection list containing .git directories
  • Added tracking for excluded directories via excludedDirs map
  • 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.

Comment on lines 575 to 621
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 {
Copy link

Copilot AI Nov 27, 2025

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.

Copilot uses AI. Check for mistakes.
}
} else if projectRoot != "" {
// Detect language at project root and cache result
} else if projectRoot != "" && !isExcluded {
Copy link

Copilot AI Nov 27, 2025

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.

Copilot uses AI. Check for mistakes.
@markcallen markcallen force-pushed the chore/ignore_git_dirs branch from 2a72932 to bc8af7e Compare November 27, 2025 05:02
@markcallen markcallen requested a review from Copilot November 27, 2025 05:02
Copy link
Contributor

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

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.

@markcallen markcallen requested a review from Copilot November 27, 2025 05:26
Copy link
Contributor

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

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.

markcallen and others added 3 commits November 26, 2025 21:37
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.
@markcallen markcallen merged commit c302f75 into main Nov 27, 2025
4 checks passed
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.

Exclude .git directories from scanning in dev-cache

2 participants