Update libgit2 overlay to v1.9.7 and fix safe.directory case matching on Windows - #2095
Draft
tyrielv wants to merge 1 commit into
Draft
Update libgit2 overlay to v1.9.7 and fix safe.directory case matching on Windows#2095tyrielv wants to merge 1 commit into
tyrielv wants to merge 1 commit into
Conversation
Bump the pinned libgit2 vcpkg overlay from v1.9.4 to v1.9.7, the latest 1.9.x release, and add a patch that makes safe.directory allowlist matching case-insensitive on Windows. On Windows, Git canonicalizes both the repository path and each safe.directory allowlist entry to their on-disk form before comparing them, so the match is effectively case-insensitive over the whole path, including the drive letter. libgit2 compared the paths with a case-sensitive strcmp, so an entry like c:/repo did not match a repository recorded as C:/repo (a drive-letter case mismatch is the common case), and the repository failed to open with a spurious GIT_EOWNER ownership error. The patch switches the comparison to STRCMP_CASESELECT gated on GIT_WIN32; POSIX filesystems stay case-sensitive. It carries the fix from libgit2 issue 7037 (fork branch tyrielv/safe-directory-drive-case, commit 6074349), rebased onto v1.9.7. The upstream commit targets libgit2 main, whose validate_ownership_cb has an extra %(prefix) handling branch that v1.9.7 lacks, so the overlay carries only the single-comparison hunk. The upstream Windows-only tests are omitted because the overlay builds with BUILD_TESTS=OFF. Verified: all three overlay patches apply cleanly to the v1.9.7 source, and a full vcpkg build of libgit2 v1.9.7 (x64-windows-dynamic) with the overlay compiles repository.c and produces git2.dll. Assisted-by: Claude Opus 4.8 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
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.
Summary
Update the pinned libgit2 vcpkg overlay from v1.9.4 to v1.9.7 (the latest 1.9.x release) and add a patch that makes
safe.directoryallowlist matching case-insensitive on Windows.Problem
On Windows, Git canonicalizes both the repository path and each
safe.directoryallowlist entry to their on-disk form before it compares them, so the match is effectively case-insensitive over the whole path, including the drive letter. libgit2 compared the paths with a case-sensitivestrcmp, so an entry likec:/repodid not match a repository recorded asC:/repo. A drive-letter case mismatch is the common case. The repository then failed to open with a spuriousGIT_EOWNERownership error.Fix
The patch switches the comparison to
STRCMP_CASESELECTgated onGIT_WIN32. POSIX filesystems stay case-sensitive. It carries the fix from libgit2 issue #7037, rebased onto v1.9.7. The upstream commit targets libgit2main, whosevalidate_ownership_cbhas an extra%(prefix)handling branch that v1.9.7 lacks, so the overlay carries only the single-comparison hunk. The upstream Windows-only tests are omitted because the overlay builds withBUILD_TESTS=OFF.Changes
overlays/libgit2/safe-directory-icase.diff— new patch (issue #7037)overlays/libgit2/portfile.cmake— add the patch toPATCHES; bumpSHA512overlays/libgit2/vcpkg.json—version-semver1.9.4 → 1.9.7overlays/libgit2/README.md— document the patch and the version bumpVerification
x64-windows-dynamic) with the overlay compilesrepository.cand producesgit2.dll.