Repository navigation
Read the patch number before Apple's build note in git --version [patch] - #201
Merged
Merged
Conversation
"git version 2.39.3 (Apple Git-145)" split into a third component of "3 (Apple Git-145)", which
failed to parse whole and fell back to 0, so GetVersionAsync reported 2.39.0 on macOS. Each
component now reads its leading digits, which also keeps the patch of an rc build ("1-rc0").
Fixes #158
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rt1SUkG3bsTZEWbmGirSx3
|
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 #158
What changed
On macOS,
GetVersionAsyncreported Apple's git (git version 2.39.3 (Apple Git-145)) as 2.39.0. Splitting on.made the third component"3 (Apple Git-145)". That string doesn't parse as a whole integer, soReadComponentfell back to 0.GitVersionParser.ReadComponentnow parses each component's leading digits:"3 (Apple Git-145)"reads as 3."1-rc0"reads as 1. Before, it also fell back to 0, which only gave the right answer when the patch happened to be 0."windows", still reads as 0.Rawis unchanged. The major component is still parsed strictly and still throws when it isn't a number.Tests (
GitVersionParserTests)ParsesApplesBuildNoteAfterThePatchComponent:2.39.3 (Apple Git-145)parses as 2.39.3, andRawkeeps the note.ParsesAReleaseCandidateSuffixOnThePatchComponent:2.41.1-rc0parses as 2.41.1.With the parser change reverted, both tests fail and the five existing cases still pass. With the change, the full suite passes (776/776).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Rt1SUkG3bsTZEWbmGirSx3
Generated by Claude Code