[02/08] replace commit identity storage with gix-backed aliases#96
Open
mjc wants to merge 15 commits into
Open
[02/08] replace commit identity storage with gix-backed aliases#96mjc wants to merge 15 commits into
mjc wants to merge 15 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 begins the migration of commit-identity storage from git2::Oid to a gitoxide-friendly representation by backing the alias store with gix::ObjectId and iddqd::IdHashMap, while keeping the external identity model as compact u32 aliases. It also updates SHA-prefix lookup and heatmap generation to avoid allocation-heavy OID stringification, and introduces test infrastructure to stabilize language/global state and git repo fixtures.
Changes:
- Replaced
core::oids::Oidsinternals withgix::ObjectIdstorage +iddqd-backed alias records, with explicitgit2↔gixconversion and a transitionalIntoGixOidboundary. - Reworked SHA-prefix navigation to validate hex input and match against OID bytes/nibbles (no
to_string()scanning / reinterning). - Updated heatmap counting to use fixed-size arrays (and a streaming
HeatmapCountshelper), and adjusted graph/app/test call sites accordingly.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/helpers/localisation.rs | Uses stable tempfile paths and adds a language guard to prevent global-language test interference. |
| src/tests/helpers/keymap.rs | Adds language guard and removes manual language reset in keymap localisation test. |
| src/tests/helpers/heatmap.rs | Adds tests for new heatmap counting + streamed helper + prefix matching behavior. |
| src/tests/git/queries/remotes.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/git/queries/diffs.rs | Switches test repos to shared init_repo_at fixture and renames a local seeded init helper. |
| src/tests/git/actions/reverting.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/git/actions/rebasing.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/git/actions/merging.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/git/actions/cherrypicking.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/git/actions/branching.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/core/walker.rs | Updates tests to use new OID alias APIs (get_existing_alias, non-reference OID access). |
| src/tests/core/oids.rs | Adds focused tests for aliasing and prefix lookup without reinterning. |
| src/tests/core/graph_service.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/app/state/app.rs | Adds tests for wait_until_graph_complete success and error modes. |
| src/tests/app/input/navigation.rs | Switches test repos to shared init_repo_at fixture and adds language guard for language selection test. |
| src/tests/app/input/git.rs | Switches test repos to shared init_repo_at fixture. |
| src/tests/app/draw/settings.rs | Adds language guard to settings shortcut localisation rendering test. |
| src/main.rs | Adds --exit-when-graph-complete mode and CLI repo path handling for benchmarking/scripted runs. |
| src/lib.rs | Exposes new git::gix module and test-only git::test_support. |
| src/helpers/heatmap.rs | Replaces map-based heatmap counting with fixed-size arrays + HeatmapCounts, and adds sorted-alias heatmap builder. |
| src/helpers/branch_visibility.rs | Adds byte-slice refname parsing helper for gix-backed reference iteration. |
| src/git/test_support.rs | Introduces centralized test fixtures (repo init, commits, worktrees, submodules, temp paths, language guard). |
| src/git/gix.rs | Adds small gix integration helpers (object cache, commitgraph hint, branch tip iteration, error mapping). |
| src/core/walker.rs | Updates walker call sites to handle OIDs as values (no deref) after Oids API changes. |
| src/core/oids.rs | Implements new gix-backed alias store, conversion helpers, reserve/shrink helpers, and nibble-based prefix matching. |
| src/core/graph_service.rs | Switches heatmap building to sorted aliases and updates lookup paths to use new alias/prefix APIs. |
| src/app/input/worktrees.rs | Updates worktree selection logic to use get_existing_alias instead of direct map access. |
| src/app/input/navigation.rs | Updates parent/child navigation to use value OIDs and get_existing_alias. |
| src/app/input/modals.rs | Replaces SHA search via stringified OIDs with get_alias_by_prefix. |
| src/app/input/git.rs | Updates stash-related OID retrieval to new value-returning Oids API. |
| src/app/draw/stashes.rs | Updates stash rendering to use value OIDs (no deref). |
| src/app/app.rs | Adds bootstrap/shutdown helpers, adds wait_until_graph_complete, and makes sync resilient to graph channel disconnects. |
| Cargo.toml | Adds gitoxide/iddqd dependencies (gix, iddqd, etc.) and supporting crates. |
| Cargo.lock | Locks new dependency graph for gix/iddqd and transitive additions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Stacked on
mjc/gitoxide-spike-01-gix-boundary.Why this PR exists:
iddqddependencies.Oidsstructure stored rawgit2::Oidvalues in aVecand used aHashMap<git2::Oid, u32>for alias lookup.gix::ObjectId, stores alias records in aniddqd::IdHashMap, and keeps the public alias path centered on smallu32aliases.git2call sites, so this is not a full gitoxide migration yet. It is the commit-identity storage layer that lets later PRs keep moving the graph/query code toward gix-backed data.What changed:
Oidsinternals with:gix::ObjectIdfor stored object IDs.IdHashMap<OidRecord>for OID → alias lookup.Vec<ObjectId>for alias → OID lookup.git2↔gixOID conversion helpers.IntoGixOidso existinggit2::Oidcall sites can cross the boundary while the rest of the stack is migrated.get_existing_aliasfor non-interning alias lookup.get_alias_by_prefixso SHA-prefix navigation can find an existing alias without stringifying and reinserting OIDs.oids/aliases.Algorithm difference:
gix::ObjectIdplus typediddqdrecords instead ofgit2::Oidplus a standard hash map.git2behavior is preserved by converting back togit2::Oidat remaininggit2call sites.HeatmapCountshelper.Performance story:
git2::Oidcollections.to_string().starts_with(...)scans and uses byte/nibble comparison instead.Benchmark Results for this PR
Command shape:
hyperfine --warmup 5 './target/release/guitar /home/mjc/src/linux --exit-when-graph-complete'.CPU: M1 MacBook Pro 16GB
02-gix-oids1:14.262.12x65.41s2.17s91%CPU: 5950x Linux/ZFS
02-gix-oids1:10.851.40x69.07s1.78s100%Memory: 5950x Linux/ZFS
02-gix-oids1.38G2.63GTop 10 heaptrack allocation sites for `02-gix-oids`
18210838 calls, 70.52M peak - git__calloc17431852 calls, 21.44M peak - git__substrdup6613871 calls, 18.44M peak - commit_parse4576967 calls, 0B peak - inflateInit2_4514697 calls, 265.92M peak - git__strndup4209519 calls, 279.42K peak - git_commit_list_insert2765451 calls, 366.68M peak - alloc::raw_vec::RawVecInner<>::finish_grow2096782 calls, 0B peak - git_commit_list_insert_by_date847866 calls, 472.20K peak - git_delta_apply484765 calls, 24.61M peak - alloc::sync::Arc<>::make_mut