perf: Remove libgit2/git2 dependency, replace with gix-object#12015
Merged
Conversation
Remove the git2 and libgit2-sys dependencies entirely. libgit2-sys was a 25-second serial C compilation on the critical build path — the single largest bottleneck in the build. Production code changes: - hash_object.rs: Replace git2::Oid::hash_file with gix_object::compute_hash (gix-object was already compiled transitively, zero new crates added) - Remove all #[cfg(feature = "git2")] conditional compilation - Collapse dual codepaths (git2 + CLI) into single CLI codepaths for ls-tree, status, worktree detection, and branch/SHA queries - repo_index.rs: Use gix-index path unconditionally (was already preferred) - turborepo-boundaries: Drop gitignore check (was already the fallback) Test changes: - Replace all git2 test fixtures with git CLI subprocess calls - Add regression test verifying blob hashes match `git hash-object`
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Coverage Report
|
github-actions Bot
added a commit
that referenced
this pull request
Feb 27, 2026
## Release v2.8.12-canary.3 Versioned docs: https://v2-8-12-canary-3.turborepo.dev ### Changes - fix: Prevent peerDependencies from overwriting concrete dependency specifiers (#12004) (`a038409`) - ci: Trigger prysk integration tests via `cargo nextest` (#11999) (`2053ede`) - release(turborepo): 2.8.12-canary.2 (#12005) (`dccfdf0`) - fix: Resolve correct nested package version in bun lockfile pruning (#12008) (`95dff45`) - refactor: Replace shell-based fixture setup with pure Rust (#12006) (`a743e38`) - fix: Resolve all lockfile pruning test failures (#12009) (`21dcaed`) - perf: Extract query module into turborepo-query crate (#12007) (`0604379`) - refactor: Migrate dry-json prysk tests to Rust + insta snapshots (#12010) (`2606f3f`) - perf: Deduplicate petgraph, fixedbitset, and dashmap (#12011) (`9b11ef6`) - refactor: Migrate persistent-dependencies and task-dependencies to Rust + insta (#12012) (`9aab7b5`) - test: Add lockfile-tests fixture for issue #12013 (#12014) (`bae81f7`) - perf: Remove libgit2/git2 dependency, replace with gix-object (#12015) (`fbf50e5`) - refactor: Migrate daemon, jsonc, query, edit-turbo-json tests to Rust (#12016) (`bf730d5`) - perf: Remove async-graphql from turborepo-lib (#12017) (`7c8a4a0`) - refactor: Migrate inference and run-logging tests to Rust (#12018) (`dc4f922`) - refactor: Migrate run-caching and strict-env-vars tests to Rust (#12020) (`c07645d`) - fix: Mark lockfile-aware-caching/bun prysk test as flaky (#12021) (`c60f0c1`) - fix: Add nextest retries for flaky tests (#12027) (`9d90270`) - refactor: Migrate prune and run-summary tests to Rust (#12022) (`329bdb5`) - ci: Increase Rust test partitions from 4 to 10 (#12028) (`0c1bd47`) - fix: Add nextest retries for flaky prysk tests (#12030) (`9b66431`) - ci: Use larger runners for macOS Rust tests (#12029) (`9479a54`) - fix: Add nextest retries for flaky prune_test::test_prune_composable_config (#12032) (`b47e099`) - fix: Suppress npm upgrade notices in Rust integration tests (#12033) (`f698b04`) - ci: Disable flaky Rust unit tests from release pipeline (#12034) (`829b351`) --------- Co-authored-by: Turbobot <turbobot@vercel.com>
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.
Summary
git2andlibgit2-sysentirely from the dependency treegix-object::compute_hash(already compiled transitively — zero new crates)#[cfg(feature = "git2")]dual codepaths into single implementationsgit hash-objectWhy
libgit2-syswas a 25-second serial C compilation sitting on the critical build path. Every crate downstream ofturborepo-scmwas blocked waiting for it. Sincegix-objectis already in the dependency tree (viagix-index), this change removes 25s of serial C compilation with zero new crate additions.What changed
Production code: The codebase already had CLI fallbacks (
gitsubprocess calls) for every git2 operation — branch detection, SHA queries, ls-tree, status, worktree discovery. The git2 paths were just in-process optimizations. This PR removes the git2 paths and keeps the CLI paths as the sole implementation. The one exception is blob hashing (hash_object.rs) which now usesgix_object::compute_hashinstead ofgit2::Oid::hash_file.repo_index.rs: The gix-index path (reading.git/indexdirectly) was already the preferred path with libgit2 as fallback. Now it's the only path.turborepo-boundaries: Drops the gitignore check (status_should_ignore) which was already the fallback behavior when git2 was disabled. The glob patterns already excludenode_modules.Tests: All git2 test fixtures replaced with
Command::new("git")subprocess calls. Addedtest_blob_hash_matches_git_hash_objectregression test that verifies empty files, text files, binary files, and large files all produce OIDs identical togit hash-object.For reviewers
The
-771 +289line delta is mostly deletion of git2 codepaths that had CLI equivalents. Thetest_merge_basetest neededgit reset --softinstead ofgit checkout --detachto match git2'sset_head_detachedbehavior (moves HEAD without resetting the working tree).