etc/plans/git2-to-gix-migration.md
Most of the broad migration is already done. This document only tracks the remaining scope needed to finish, plus the intentional git2 boundaries that are still allowed.
Repository audit on 2026-04-02:
git2:: callsites in crates/**/*.rs: 146git2:: references: 24ctx.git2_repo / ctx.with_git2_repo callsites: 23git2 is still acceptable only where we do not yet have a practical gix replacement or where the code is deliberately acting as a compatibility adapter:
Anything outside those areas should continue moving to gix.
The remaining work is concentrated in a small set of areas:
These modules still sit on the main checkout/index boundary and should be kept narrow:
crates/gitbutler-workspace/src/branch_trees.rscrates/gitbutler-edit-mode/src/lib.rscrates/gitbutler-oplog/src/oplog.rscrates/gitbutler-branch-actions/src/integration.rsGoal:
git2 usage isolated to the actual checkout/index handoffgix where possibleThese files still appear to contain actionable non-boundary git2 usage or backend leakage:
crates/gitbutler-repo/src/repository_ext.rscrates/gitbutler-repo/src/commands.rscrates/gitbutler-repo/src/rebase.rscrates/gitbutler-repo/src/credentials.rscrates/gitbutler-repo/src/hooks.rscrates/gitbutler-repo/src/managed_hooks.rscrates/gitbutler-repo/src/remote.rscrates/gitbutler-repo/src/staging.rscrates/gitbutler-repo-actions/src/repository.rscrates/gitbutler-tauri/src/projects.rscrates/but-napi/src/lib.rsGoal:
gix-first APIs for repo reads and domain logicgit2 repositories through higher-level application code unless required by the accepted boundarySome crates still intentionally expose git2 compatibility helpers or legacy types:
crates/but-ctx/src/lib.rscrates/but-oxidize/src/lib.rscrates/but-serde/src/lib.rscrates/but-schemars/src/lib.rscrates/gitbutler-repo/src/lib.rscrates/gitbutler-cherry-pick/src/*crates/gitbutler-commit/src/commit_ext.rscrates/gitbutler-stack/src/stack.rsGoal:
Test-only git2 usage still exists and should continue shrinking unless it is exercising the accepted hard boundary:
crates/gitbutler-branch-actions/tests/*crates/gitbutler-edit-mode/tests/edit_mode.rscrates/gitbutler-repo/tests/*crates/but-testsupport/src/legacy/*Goal:
gix and but-* helpers for fixtures and assertionsgit2 setup only where boundary coverage actually requires itThe intended end state is:
gix::ObjectId, gix refs, config, and read-side repository access in normal application logicContext::git2_repo treated as a deprecated boundary escape hatch onlygit2 usage limited to explicit hard-boundary or compatibility-adapter codeThis plan is complete when all of the following are true:
git2.git2 use is confined to the accepted boundary or explicit compatibility/adapter code.ctx.git2_repo callers are limited to those accepted sites.gix by default unless boundary coverage requires git2.Recommended checks:
cargo clippy --all-targets --workspace
rg -n "git2::" crates -S --glob '*.rs'
rg -n "ctx\\.(git2_repo|with_git2_repo)" crates -S --glob '*.rs'
Context::git2_repo deprecatedgit2 usage reduced to boundary coverage onlygit2 audit at zero outside accepted boundaries