Skip to content

fix(git): managed status-calculator parity with libgit2 (symlinks, eol, global excludes) - #5058

Merged
arturcic merged 2 commits into
GitTools:feature/managed-gitfrom
arturcic:feature/managed-git-parity-adversarial
Jul 13, 2026
Merged

arturcic merged 2 commits into
GitTools:feature/managed-gitfrom
arturcic:feature/managed-git-parity-adversarial

Conversation

@arturcic

Copy link
Copy Markdown
Member

Description

Fixes the three UncommittedChanges parity bugs in the managed backend's status calculator, surfaced by the corpus parity script (#5056) diffing managed vs libgit2 on real repositories. All version-calculation fields were already parity-clean; these were the only differences, and libgit2's behavior is the spec.

Part of #5031 (Phase B correctness).

Bugs fixed (src/GitVersion.Git.Managed/Status/GitStatusCalculator.cs)

  1. Tracked symlinks — FileInfo followed the link, so a symlink whose target is a directory or missing counted as deleted, and file-symlinks were hashed against target content. Git hashes the readlink target path as the blob for a 120000 entry; the untracked walk also no longer descends through directory symlinks (previously a potential escape outside the working tree). Repro: GitVersion's own .claude/skills/release symlink (managed reported 1 uncommitted change, libgit2 0).
  2. .gitattributes eol/text filters — a CRLF checkout of an LF blob was flagged modified on raw size/hash. Now retries with CRLF-normalized content when a check-in filter applies. Repro: GitReleaseManager's eol=crlf files (managed reported 8, libgit2 0).
  3. Global excludes — untracked-file scan now honors core.excludesFile and the XDG default ignore (hermetic via GIT_CONFIG_GLOBAL/XDG_CONFIG_HOME).

Tests

Expands DualBackendParityTests with adversarial fixtures (criss-cross, equal-timestamp histories, symlinks, eol) — the in-repo dual-backend proxy for the corpus diff.

Verification

  • dotnet build ./src/GitVersion.slnx — 0 warnings, 0 errors
  • Managed.Tests — 135/135
  • DualBackendParityTests — 18/18

🤖 Generated with Claude Code

@arturcic arturcic added this to the 7.x milestone Jul 13, 2026
@arturcic
arturcic force-pushed the feature/managed-git-parity-adversarial branch from 83d49fc to eb1ec27 Compare July 13, 2026 09:50
arturcic and others added 2 commits July 13, 2026 14:32
… tests

Fixes the three UncommittedChanges parity bugs surfaced by corpus diffing
against libgit2:
- tracked symlinks: blob is the readlink target path, not the pointed-to
  content; do not descend through directory symlinks
- .gitattributes eol/text filters: retry with CRLF-normalized content so a
  CRLF checkout of an LF blob counts as clean
- honor global core.excludesFile / XDG git ignore for untracked files

Expands DualBackendParityTests with adversarial fixtures (criss-cross,
equal-timestamp, symlinks, eol). The corpus parity script itself lands
separately in the pwsh version (GitTools#5056).

Build 0/0; Managed.Tests 135/135; DualBackendParityTests 18/18.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rename locals that shadow the references/branches fields in
ManagedRepositorySession (S1117); flatten the index-vs-working-tree
comparison in GitStatusCalculator into a bool-returning helper with early
returns to cut cognitive complexity (S3776).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arturcic
arturcic force-pushed the feature/managed-git-parity-adversarial branch from f3e5356 to 5121659 Compare July 13, 2026 11:32
@arturcic
arturcic merged commit 6e3533b into GitTools:feature/managed-git Jul 13, 2026
3 of 8 checks passed
@arturcic
arturcic deleted the feature/managed-git-parity-adversarial branch July 13, 2026 11:32
@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

@sonarqubecloud

Copy link
Copy Markdown

arturcic added a commit that referenced this pull request Jul 16, 2026
…ersarial

fix(git): managed status-calculator parity with libgit2 (symlinks, eol, global excludes)
arturcic added a commit that referenced this pull request Jul 16, 2026
…ersarial

fix(git): managed status-calculator parity with libgit2 (symlinks, eol, global excludes)
arturcic added a commit to arturcic/GitVersion that referenced this pull request Jul 17, 2026
…rity-adversarial

fix(git): managed status-calculator parity with libgit2 (symlinks, eol, global excludes)
arturcic added a commit to arturcic/GitVersion that referenced this pull request Jul 17, 2026
…rity-adversarial

fix(git): managed status-calculator parity with libgit2 (symlinks, eol, global excludes)
@arturcic arturcic modified the milestones: 7.0.x, 7.0.0 Nov 15, 2026
@arturcic arturcic added the bug label Nov 15, 2026
This was referenced Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant