Skip to content

[Feature] Replace LibGit2Sharp with a managed Git implementation (managed reads + git CLI writes) #5031

Description

@gittools-bot

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#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.Managed contains 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 git on PATH.
  • 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.
  • v7.1: remove LibGit2Sharp and native binaries #5040 removes libgit2 production code and dual-backend comparison infrastructure in v7.1 while retaining only the v7 selector compatibility validator required by Align v7 feature selectors and legacy lifecycle #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions