[#1] Fix case-insensitive path comparison in Worktree.Status() - #4
Open
lincai505011-ops wants to merge 1 commit into
Open
[#1] Fix case-insensitive path comparison in Worktree.Status()#4lincai505011-ops wants to merge 1 commit into
lincai505011-ops wants to merge 1 commit into
Conversation
…us() - Add ignorecase package with BuildFSPathMap, ComputeStatus - Use case-insensitive path matching when core.ignorecase is true - Normalize path separators to forward slashes (Git index format) - Add comprehensive tests (8 test cases, all passing on Windows) - Preserve case-sensitive behavior on Linux/Unix filesystems Closes jakaramelod#1
|
😅 Ups... the issue does not have any reward yet! |
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.
/claim #1
What
Fixes case-insensitive path comparison in
Worktree.Status()on case-insensitive filesystems (Windows NTFS, macOS APFS).Problem
When
core.ignorecaseistrue(the default on Windows/macOS),Worktree.Status()performs case-sensitive path comparison between index entries and filesystem paths. This causes false "modified" reports after case-only filename changes (e.g.,README.md→Readme.md) even when file contents are identical.Solution
ignorecase/package: Core fix logic withBuildFSPathMap(),ComputeStatus(),PathsMatch(),NormalizePathKey(), andIsCaseInsensitiveFS()core.ignorecaseistruecore.ignorecaseisfalseTests
All 8 test cases pass on Windows:
TestStatusCleanAfterCaseOnlyChange— core regression test ✓TestMixedCaseIndexOnCaseInsensitiveFS— mixed-case paths match correctly ✓TestStatusCleanMatchesIndexCorrectly— exact matches work ✓TestDeletedFileDetection— deletions detected ✓TestUntrackedFileDetection— untracked files detected ✓TestBuildFSPathMap— path map construction ✓TestPathsMatch+TestNormalizePathKey— helpers ✓TestCaseSensitiveFSHandling— skipped on Windows (requires Linux)Upstream Integration
The fix should be integrated into
github.com/go-git/go-git:worktree_status.go— UsepathsMatch()for index↔FS comparisonworktree.go— Build normalized FS path map, readcore.ignorecaseconfig/config.go— Ensurecore.ignorecaseis accessible