Repository navigation
fix: respect gitignore exceptions during workspace scans - #3513
Open
Mohamed-El-Mouhib wants to merge 2 commits into
Open
Mohamed-El-Mouhib wants to merge 2 commits into
Mohamed-El-Mouhib wants to merge 2 commits into
Conversation
Fixes LuaLS#3503. Regression tests cover directory negation and actual workspace loading. AI assistance: ChatGPT.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3503.
Problem
A workspace with
*,!*/, and!*.luain.gitignorecan be skipped entirely because*matches the empty relative path at its root. Directory-only exceptions also match a parent prefix of a file, and directory type lookups use the relative path instead of the workspace path. After scanning, the cached directory type is replaced by a boolean, which can causeisIgnoredto disagree with the scan.Changes
glob.globprefix behavior unchanged. Keep the end assertion inside wildcard alternatives so a later path component can match.isIgnoredintegration. Update the changelog as required.Validation
a58fc7bfails the new matcher regression and reports no problems on a real three-file Git fixture. The patched version reports the three expected undefined globals, excluding the explicitly blocked directory (matchesgit ls-files -o --exclude-standard).test.luasuite passed using the 3.19.2 macOS arm64 release executable with the current checkout's Lua sources;basicandtclientpassed separately. After whitespace-only cleanup,basicpassed again.git diff --checkpassed; bundled code-style diagnostics show no added warnings relative to upstream. Native Windows execution and a source rebuild of the native executable were not performed.Follow-up validation
Comparing 1,599 pattern/path combinations against
git check-ignoreexposed a regression for standalone patterns containing literal commas and braces. The follow-up separates standalone parsing from the existing leading-brace group syntax, preserves escaped punctuation, and adds basic and real workspace-scan regression coverage. The new cases fail before the follow-up and pass after it. The final comparison has no introduced mismatches, 100 improvements, and 10 remaining preexisting differences; this is not a claim of complete Git compatibility. Unescaped leading braces intentionally retain legacy group syntax.The previous head's GitHub Actions macOS ARM64 build job ran both native and Lua test suites successfully. Its separate macOS test job was cancelled because the runner configuration was unavailable (also reproduced on upstream). The follow-up's complete local suite passed with the downloaded ARM64 build artifact and matching source; final basic and tclient suites also passed after strengthening URI assertions. An earlier local full-suite run failed during coroutine readiness; this was not reproduced in the follow-up run. New-head CI is separate and must still run.