GitTools / GitTools/GitVersion
[Feature] Replace LibGit2Sharp with a managed Git implementation (managed reads + git CLI writes)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.1k
- Forks
- 659
- Avg merge
- 13h 15m
- Merged PRs (30d)
- 51
Description
Description
Replace LibGit2Sharp with a hybrid Git backend: a vendored fully managed reader for read/history operations plus the git CLI for writes and network operations. The end state ships no native Git binaries.
Supersedes the exploration in arturcic/GitVersion#236. The full technical design remains in docs/design/managed-git-migration.md and must be aligned with the release plan below.
Status
Phases A, B-pre, and B are complete and merged through #5084. The managed backend is implemented and covered by backend parity tests.
The release lifecycle is now governed by #5135:
| Release | Runtime behavior |
|---|---|
| v7.0 | Managed backend is the default; GITVERSION_GIT_BACKEND=libgit2 is the temporary fallback. |
| v7.1 | LibGit2Sharp and native binaries are removed by #5040; libgit2 selection produces an actionable removal error. |
| v7.x | Explicit GITVERSION_GIT_BACKEND=managed remains accepted as a no-op for automation compatibility. |
| v8 | #5136 removes the selector variable and its compatibility validation. |
The former v7.1 default-flip issue #5039 is superseded by #5135.
Phase tracking
| Phase | Issue | State |
|---|---|---|
| A — Git CLI mutator | #5032 | Complete |
| B-pre — interface cleanup | folded into #5032 | Complete |
| B.1 — object store | #5033 | Complete |
| B.2 — refs/discovery | #5034 | Complete |
| B.3 — revwalk/merge-base | #5035 | Complete |
| B.4 — diff/status | #5036 | Complete |
| B.5 — adapter and parity | #5037 / #5084 | Complete |
| Former C — v7.1 default flip | #5039 | Superseded by #5135 |
| E — remove LibGit2Sharp | #5040 | Planned for v7.1 |
| F — commit-graph acceleration | #5041 | Optional |
Shipped architecture
src/GitVersion.Git.Managedcontains the managed reader and Git CLI executor and implements the Core Git abstractions directly.- Read-only version calculation on a prepared checkout does not require
gitonPATH. - Repository normalization, dynamic repositories, fetch, clone, checkout, and other network/write operations use the Git CLI.
- Backend selection is centralized during the v7.0 compatibility window.
- #5040 removes libgit2 production code and dual-backend comparison infrastructure in v7.1 while retaining only the v7 selector compatibility validator required by #5135.
Validation requirements
- Full integration suites and order-sensitive parity tests must remain green for both backends until libgit2 removal.
- Managed tests cover loose/packed objects, delta resolution, refs, worktrees, shallow repositories, revwalk ordering, merge-base, tree diff, index/status, and repository preparation.
- Artifact tests verify that v7.1 packages contain no LibGit2Sharp assemblies or
runtimes/**/native/*entries. - Migration and breaking-change documentation must consistently reflect the v7.0 managed default, v7.1 removal, and v8 selector cleanup.
Related follow-ups
- #2921 tracks lightweight dynamic repositories and remote-ref discovery separately.
- #5135 aligns parser, configuration, and Git-backend selectors across v7.
- #5136 removes the selector variables in v8.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read docs/design/managed-git-migration.md and the release plan in #5135, then inspect src/GitVersion.Git.Managed and the phase issues listed here. The work is complete for the managed backend; remaining validation follows #5040, including full integration and parity suites, artifact checks, and consistent v7/v8 documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- backend, cli, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 15/100