Repository navigation
feat: git CLI backend for mutating/network operations behind GITVERSION_GIT_BACKEND switch - #5042
Merged
arturcic merged 7 commits intoJul 11, 2026
Conversation
…a managed Git implementation Hybrid approach: vendored managed reader (ported from NBGV ManagedGit) for all read/history operations, git CLI shell-out for writes and network. Removes all native libgit2 binaries. See GitTools#5031. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Type CommitFilter.IncludeReachableFrom/ExcludeReachableFrom as new ICommitish marker interface (implemented by ICommit and IBranch) instead of object? - Map CommitSortStrategies to LibGit2Sharp explicitly instead of relying on numeric enum value parity - Internalize LibGit2SharpExtensions.ToGitRepository (test-only usage) and expose it to test assemblies via InternalsVisibleTo Preparation for the managed Git backend (GitTools#5031), so both backends implement the same honest contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New GitVersion.Git.CommandLine project with a Process-based GitCliExecutor and GitCliMutator implementing clone (--no-checkout), fetch, checkout and ls-remote. GitRepository routes its IMutatingGitRepository operations to the CLI when GITVERSION_GIT_BACKEND_MUTATOR=cli is set (default remains libgit2), refreshing cached collections after external mutations. Parity details vs libgit2: canonical refs/heads/* checkout attaches HEAD (git would detach), --no-guess suppresses remote-branch DWIM, ls-remote drops peeled and symbolic HEAD entries, stderr mapped to the existing LockedFileException/401/403/404 handling, basic auth passed per invocation via http.extraHeader. Phase A of GitTools#5031. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ar and test both in CI - GITVERSION_GIT_BACKEND=libgit2|managed selects the whole backend stack; 'managed' opts into the new implementation as far as it exists (currently the git CLI mutator, later also the managed reader). Default: libgit2. - Unit-test workflow matrix gains a git_backend dimension so the full suite runs against both backends on every OS until libgit2 is removed; coverage and test summaries publish from the libgit2 leg only. - Both backends will ship side by side for several releases to give users a testing window before libgit2 is dropped (GitTools#5031). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ction API changes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… key Recent git versions write clone refs only to packed-refs and may not create the refs directory at all, so a git-CLI clone (managed backend) can produce a repository without .git/refs. Hash empty contents instead of throwing DirectoryNotFoundException. Fixes the ubuntu managed-backend CI legs (CacheKeyForWorktree, CacheKeySameAfterReNormalizing). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
|
Thank you @arturcic for your contribution! |
arturcic
added a commit
that referenced
this pull request
Jul 16, 2026
feat: git CLI backend for mutating/network operations behind GITVERSION_GIT_BACKEND switch
arturcic
added a commit
to arturcic/GitVersion
that referenced
this pull request
Jul 17, 2026
…gration feat: git CLI backend for mutating/network operations behind GITVERSION_GIT_BACKEND switch
arturcic
added a commit
that referenced
this pull request
Jul 17, 2026
feat: git CLI backend for mutating/network operations behind GITVERSION_GIT_BACKEND switch
78 of 100 tasks
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.



Description
First step of the LibGit2Sharp replacement (#5031): a git CLI backend for all mutating and network operations, selectable via a single environment variable, with the design document and the interface cleanups that later phases build on.
Closes #5032
What's included
docs/design/managed-git-migration.md): motivation, library landscape research, LibGit2Sharp surface analysis, target architecture, phases A–F with the explicit release mapping (v7.0 defaultlibgit2, v7.1 defaultmanaged, removal later), risks and verification strategy.CommitFilter.IncludeReachableFrom/ExcludeReachableFromtyped via newICommitishmarker (implemented byICommit/IBranch) instead ofobject?;CommitSortStrategiesmapped explicitly to LibGit2Sharp instead of a numeric cast; publicIRepository.ToGitRepository()extension internalized.GitVersion.Git.CommandLine: Process-basedGitCliExecutor(argument lists,LC_ALL=C,GIT_TERMINAL_PROMPT=0) andGitCliMutatorimplementing clone (--no-checkout), fetch, checkout andls-remote, with per-invocation basic auth viahttp.extraHeaderand stderr mapped onto the existingLockedFileException/401/403/404 handling.GITVERSION_GIT_BACKEND=libgit2|managed;GitRepositoryroutes itsIMutatingGitRepositoryoperations through the CLI whenmanagedis selected. Default remainslibgit2for v7.0.git_backenddimension — the full suite runs against both backends on every OS until libgit2 is removed.GitVersionCacheKeyFactoryno longer throws when.git/refsis absent (fresh clones by recent git versions keep all refs packed).Parity notes (managed backend vs libgit2)
refs/heads/prefix (git would detach where libgit2 attaches) and passes--no-guess(libgit2 has no remote-branch DWIM).ls-remoteparsing drops peeled^{}and symbolicHEADentries to matchListReferences.Verification
GitVersion.Core.Tests(36k) andGitVersion.App.Tests(345) pass with bothGITVERSION_GIT_BACKEND=libgit2and=managed; CI matrix green on all OS × .NET × backend legs.🤖 Generated with Claude Code