Skip to content

test: migrate GitVersion.Testing fixtures from LibGit2Sharp to the git CLI (Phase D) - #5063

Closed
arturcic wants to merge 2 commits into
GitTools:feature/managed-gitfrom
arturcic:feature/managed-git-fixtures
Closed

arturcic wants to merge 2 commits into
GitTools:feature/managed-gitfrom
arturcic:feature/managed-git-fixtures

Conversation

@arturcic

Copy link
Copy Markdown
Member

Description

Phase D of the LibGit2Sharp replacement (#5031): migrate GitVersion.Testing off LibGit2Sharp to the git CLI. This removes the LibGit2Sharp dependency from the test-fixture layer — a prerequisite for eventually removing it from the product (Phase E, post-7.0).

Closes #5038

What changed (test-only — zero product source files)

  • GitVersion.Testing no longer references LibGit2Sharp (no package reference, no source usage). A git-CLI-backed fixture API under GitVersion.Testing/Git/ (TestRepository, TestCommit, TestBranch, TestTag, TestReference/Remote/Worktree collections, Signature, CommitOptions, Commands shim) replaces the LibGit2Sharp types, preserving the existing helper names/shapes so the vast majority of call sites compile unchanged.
  • Determinism via GIT_AUTHOR_*/GIT_COMMITTER_* env per invocation; hermetic isolation via -c commit.gpgsign=false -c gc.auto=0 -c core.autocrlf=false and GIT_CONFIG_NOSYSTEM/GIT_CONFIG_GLOBAL.
  • ~51 test files touched; 19 were a bare using LibGit2Sharp; removal, 7 had substantive edits. GitVersion.Git.Managed.Tests keeps a LibGit2Sharp reference (its parity tests legitimately compare against the libgit2 backend).

Known tradeoff

Test-suite runtime increases (~3.5× on Core.Tests) because the git CLI spawns a process per write where libgit2 was in-process. Accepted for now; can be optimized later with batched history creation if it becomes a CI pain point.

Verification

  • src + new-cli build 0 warnings / 0 errors; dotnet format --verify-no-changes clean.
  • Full suites green in both GITVERSION_GIT_BACKEND unset and =managed modes (Core 36144, App 345, BuildAgents 91, Configuration 95, Output 123, MsBuild 151, Managed 141).
  • The managed-mode MsBuild flakiness seen during development was a separate pre-existing test-fixture env-var race, fixed independently in test(msbuild): serialize process-wide env mutation across MsBuild fixtures #5062 (now merged); this branch inherits it and runs clean (3/3 managed-mode MsBuild runs here).

🤖 Generated with Claude Code

@arturcic arturcic added this to the 7.x milestone Jul 14, 2026
…t CLI

Replace the LibGit2Sharp-backed test fixtures in GitVersion.Testing with a
git-CLI-backed Test* fixture API (TestRepository, TestBranch, TestCommit,
TestTag, TestRemote and related collections, driven by GitCliRunner). This
removes the LibGit2Sharp package dependency from GitVersion.Testing entirely
while keeping the RepositoryFixtureBase / EmptyRepositoryFixture /
BaseGitFlowRepositoryFixture surface used by the test suites unchanged.

Changes are confined to test code (GitVersion.Testing and the *.Tests
projects); no product code is touched.

Verification (net10.0): src and new-cli solutions build 0 warnings / 0
errors; dotnet format clean. All test suites pass in both GITVERSION_GIT_BACKEND
unset and managed modes (Core.Tests 36144 tests green in both modes).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arturcic
arturcic force-pushed the feature/managed-git-fixtures branch from 00dd0ba to 43b1209 Compare July 14, 2026 11:23
The Phase D fixture migration runs ~3x slower on macOS/Windows runners
(git-CLI spawns per write), overrunning the 30-min step timeout. Temporary
bump to unblock CI; revert when the fixture speedup lands. See GitTools#5031.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@arturcic

Copy link
Copy Markdown
Member Author

Parking Phase D. Decision: keep LibGit2Sharp in GitVersion.Testing (a test-only, non-shipped assembly). Removing it there buys nothing for the actual goal — stopping the shipped product from carrying native libgit2 binaries — because test fixtures aren't shipped, while the git-CLI fixture rewrite imposes a permanent ~3x test-suite slowdown (30-min CI step timeouts on macOS/Windows). The product/adapters can still go fully libgit2-free in Phase E without migrating the fixtures. Branch kept for reference. Supersedes #5038.

@arturcic arturcic closed this Jul 15, 2026
@arturcic
arturcic deleted the feature/managed-git-fixtures branch July 17, 2026 09:18
@arturcic arturcic modified the milestones: 7.0.x, 7.0.0 Nov 15, 2026
@arturcic arturcic added the build label Nov 15, 2026
@arturcic arturcic removed this from the 7.0.0 milestone Nov 17, 2026
@arturcic arturcic mentioned this pull request Nov 17, 2026
78 of 100 tasks
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