Fix version height computed as 0 when project path has non-canonical casing #1244
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.
When a project's repo-relative path case doesn't match what git records (e.g., project reports path as
a/b
but git records it asA/b
), the managed git implementation fails to walk the tree when searching for version.json files. This results in a version height of 0 instead of the correct value.Root Cause
The issue was in
ManagedVersionFile.GetVersion()
at line 164 whereGetTreeEntry()
uses case-sensitive matching to find directory entries. When the path casing doesn't match git's records, the tree walk fails and no version.json file is found.Solution
This PR implements case-insensitive fallback logic for the managed git implementation:
Git Config Reading: Added
ReadIgnoreCaseFromConfig()
method to readcore.ignorecase
setting from git configuration files (both repository-specific and global)Case-Insensitive Tree Matching: Extended
GitTreeStreamingReader.FindNode()
with an optionalignoreCase
parameter that performs ASCII case-insensitive comparisonFallback Logic: Modified
GitRepository.GetTreeEntry()
to attempt case-insensitive matching whencore.ignorecase=true
and the initial case-sensitive search failsExample
Testing
Fixes #618.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)dotnetbuilds.azureedge.net
curl --retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs REDACTED
(dns block)curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.