fix: unborn-first-commit — soporte para repos recién inicializados#207
Merged
Conversation
WHY Operations on fresh repositories with zero commits caused crashes or errors because HEAD resolution failed. Additionally, using non-pointer integers for Ahead/Behind fields made it impossible to distinguish between a valid count of zero and missing data when no upstream was configured. WHAT * Guarded git commands against unborn state by making HEAD resolution best-effort and falling back to empty tree hash. * Changed Ahead and Behind fields in GitStatus and BranchInfo structs from int to *int to support null values. * Conditionally append parent flags only when a valid parent hash exists for root commits.
Owner
Author
|
/label type:bug |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Closes #204
Summary
Status.Ahead/Behindpasan a*intconnullen unborn (semánticamente correcto)CommitTreeomite-pcuando no hay parent (root commit)session startybackuptoleran unborn HEADChanges
internal/core/domain/git.goStatus.Ahead/Behind:int→*int, sinomitemptyinternal/delivery/mcp/prreview/result.goBranchInfo.Ahead/Behind:int→*intinternal/adapters/git/exec_write_commit.goCommitTree: args condicionales, omite-psi no hay parentinternal/delivery/mcp/core/commit_handler.goapplyPlumbing: toleraHead()fallandointernal/adapters/git/exec_read_info.goStatus: detecta unborn, skipearev-listinternal/delivery/mcp/shared/helpers.goFormatStatusJSON: nil-safe*intinternal/delivery/mcp/prreview/handler.goBranchInfointernal/delivery/mcp/session/session.gohandleStart:emptyTreeHashfallbackinternal/adapters/git/exec_backup.gocollectReachabilityTips: tolera unbornTest Plan
go test ./... -short— 40 packages, 0 regresionesgo vet ./...— clean