[01/08] add gitoxide boundary and typed OID alias storage dependencies#95
[01/08] add gitoxide boundary and typed OID alias storage dependencies#95mjc wants to merge 7 commits into
Conversation
(cherry picked from commit 122fdf1)
Wire a no-TUI entry point that loads the repo, skips workdir status to avoid case-colliding paths on case-insensitive filesystems, waits for the graph walker to finish, prints the commit count, and shuts down background tasks.
There was a problem hiding this comment.
Pull request overview
This PR lays the groundwork for a staged migration toward gitoxide by introducing a dedicated git::gix boundary module and adding the dependency set needed for upcoming graph/alias work. It also centralizes common Git test fixtures under git::test_support and adds a benchmark-only headless mode (--exit-when-graph-complete) to consistently measure graph completion.
Changes:
- Add gitoxide-related dependencies (
gix,gix-worktree,gix-worktree-state) plus future typed-ID storage deps (iddqd,rustc-hash,smallvec). - Introduce
src/git/gix.rsas the initial gitoxide boundary and expose it viasrc/lib.rs. - Add benchmark-only graph-completion waiting/shutdown helpers and refactor tests to use shared
git::test_supporthelpers (including a language guard).
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/helpers/localisation.rs | Uses shared language guard and switches temp language file creation to tempfile. |
| src/tests/helpers/keymap.rs | Uses shared language guard to avoid cross-test localisation leakage. |
| src/tests/git/queries/remotes.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/git/queries/diffs.rs | Uses shared init_repo_at in temp repo helper; renames local seeded init helper. |
| src/tests/git/actions/reverting.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/git/actions/rebasing.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/git/actions/merging.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/git/actions/cherrypicking.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/git/actions/branching.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/core/graph_service.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/app/state/app.rs | Adds tests for wait_until_graph_complete behavior. |
| src/tests/app/input/navigation.rs | Uses shared init_repo_at and language guard in settings-language test. |
| src/tests/app/input/git.rs | Uses shared init_repo_at test helper for consistent repo setup. |
| src/tests/app/draw/settings.rs | Uses shared language guard for localisation-dependent rendering assertions. |
| src/main.rs | Adds --exit-when-graph-complete mode and argument-to-repo-path parsing. |
| src/lib.rs | Exposes git::gix and (test-only) git::test_support. |
| src/helpers/branch_visibility.rs | Adds byte-slice refname parsing helper for gitoxide reference names. |
| src/git/test_support.rs | Introduces reusable test fixtures for repos, worktrees, commits, and localisation guard. |
| src/git/gix.rs | Adds initial gitoxide boundary utilities (commit-graph hint, branch tip iteration, error adapter). |
| src/app/app.rs | Adds bootstrap helper, graph completion waiting, and background graph shutdown logic; improves disconnect handling in sync(). |
| Cargo.toml | Adds new dependencies for gitoxide and upcoming typed-ID/graph work. |
| Cargo.lock | Updates lockfile for the new dependency graph. |
Comments suppressed due to low confidence (1)
src/tests/git/queries/diffs.rs:66
init_seeded_repo_atusesRepository::init, which can pick the initial branch name from the developer/CI Git config (e.g.init.defaultBranch). That makes these tests less deterministic than the new sharedtest_support::init_repo_at, which pins the initial HEAD.
To keep submodule fixtures consistent across environments, reuse crate::git::test_support::init_repo_at here instead of Repository::init + manual user config.
fn init_seeded_repo_at(path: &Path) -> Repository {
fs::create_dir_all(path).unwrap();
let repo = Repository::init(path).unwrap();
{
let mut config = repo.config().unwrap();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I did say I'd get around to this, so here we are! There is still a bunch of libgit2 left to remove/narrow around diffs etc but I did the hardest bits in this 8-stack. Sorry about how massive it is, but that was really unavoidable. I will happily help get it all ship-shape and mergeable. the test linux kernel repo I used is 2.3 million commits, 44 remotes. libgit2's worktree support is the one relevant area where Happy to answer any questions or help in any way. The CLI flag I added isn't required but it made profiling and |
|
also - the later PRs look huge because they contain all the previous PRs in the stacks' changes. as these get merged they should get easier to review. |
Why this PR exists:
gixplus related worktree crates so later PRs can read Git data through gitoxide instead of continuing to spread libgit2-shaped reads through the app.iddqdas the future typed-ID storage dependency for commit/OID aliasing.rustc-hashandsmallvec.--exit-when-graph-completeflag used to measure the stack consistently.What changed in this PR:
gixgix-worktreegix-worktree-stateiddqdrustc-hashsmallvecsrc/git/gix.rsas the initial gitoxide boundary module.git::gixfromsrc/lib.rs.git::test_supportunder#[cfg(test)]and moves shared test fixture helpers behind that boundary so later PRs can reuse them without expanding production behavior.--exit-when-graph-completeCLI path and graph-completion wait helper.Cargo.lockfor the new dependency graph.What the new
git::gixboundary currently contains:gix::Repository.git2::Errorshape.What
iddqdis for, in a follow-on PR:The graph pipeline needs to refer to the same commits from multiple layers: walker, batcher, buffer, renderer, heatmap, app state, and query integration.
Passing raw Git object IDs everywhere would keep cloning, hashing, comparing, and converting object IDs across those layers. It would also leak the libgit2/gitoxide boundary into too many call sites.
The intended follow-up is to store each commit object ID once and pass a small typed alias through the rest of the app.
iddqdis added here so that storage choice can be reviewed separately from the later behavior migration.Algorithm difference:
Performance story:
Benchmark Results for the whole stack
Command shape:
hyperfine --warmup 5 './target/release/guitar /home/mjc/src/linux --exit-when-graph-complete'.CPU: M1 MacBook Pro 16GB
main2:37.281.00x118.00s7.88s80%01-gix-boundary1:43.991.51x97.85s2.33s96%02-gix-oids1:14.262.12x65.41s2.17s91%03-graph-walker5.816s27.05x1.82s0.74s43%04-queries-readonly3.812s41.26x1.47s0.42s49%05-actions-network1.993s78.91x1.47s0.26s87%06-app-integration1.826s86.13x1.51s0.10s88%06-app-integration1.879s83.70x1.44s0.11s82%07-draw-status1.618s97.21x1.36s0.08s89%CPU: 5950x Linux/ZFS
main1:39.241.00x96.16s1.72s98%01-gix-boundary1:46.410.93x101.28s3.82s98%02-gix-oids1:10.851.40x69.07s1.78s100%03-graph-walker2.094s47.39x1.59s0.55s102%04-queries-readonly1.856s53.47x1.58s0.46s110%05-actions-network1.862s53.30x1.60s0.49s112%06-app-integration1.639s60.55x1.40s0.22s98%07-draw-status1.632s60.81x1.34s0.18s93%08-bench-docs1.629s60.92x1.36s0.19s94%Memory: 5950x Linux/ZFS
main1.26G2.81G01-gix-boundary1.26G2.82G02-gix-oids1.38G2.63G03-graph-walker455.13M1.15G04-queries-readonly436.12M977.18M05-actions-network436.12M978.61M06-app-integration419.89M853.30M07-draw-status419.89M916.59M08-bench-docs419.89M988.71M