Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces various Vec<T>/slice usages that are expected to be non-empty with nonempty::NonEmpty<T> to encode invariants in types across gix-* crates, and updates dependent code/tests accordingly.
Changes:
- Introduce
nonempty::NonEmptyin shallow-boundary, merge-base, merge outcomes, commit-graph, and select internal iterators. - Adjust algorithms and call sites to use
first()/tail()andNonEmpty::from_vec()patterns. - Add
nonemptydependencies (and serde feature wiring where needed) and update tests to compare againstVecas needed.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| gix/tests/gix/repository/shallow.rs | Update shallow-commit assertions to work with NonEmpty. |
| gix/tests/gix/remote/fetch.rs | Update shallow-commit assertions to work with NonEmpty. |
| gix/tests/gix/clone.rs | Update shallow-commit assertions to work with NonEmpty. |
| gix/src/shallow.rs | Change shallow commit snapshot storage from Vec to NonEmpty. |
| gix/src/revision/walk.rs | Adjust shallow-boundary membership check for NonEmpty storage layout. |
| gix/src/repository/revision.rs | Update merge-base selection to use NonEmpty::first(). |
| gix/src/merge.rs | Change merge outcome merge_bases to Option<NonEmpty<_>>. |
| gix/Cargo.toml | Add nonempty dependency. |
| gix-shallow/src/lib.rs | Change shallow read/write APIs to return/take Option<NonEmpty<_>>. |
| gix-shallow/Cargo.toml | Add nonempty dependency and serde feature wiring. |
| gix-revision/tests/revision/merge_base/mod.rs | Adapt tests to compare Option<NonEmpty<_>> via Vec::from. |
| gix-revision/src/merge_base/mod.rs | Update octopus merge-base logic to use NonEmpty::first(). |
| gix-revision/src/merge_base/function.rs | Change merge-base return type to Option<NonEmpty<_>>. |
| gix-revision/Cargo.toml | Add nonempty dependency. |
| gix-protocol/src/fetch/function.rs | Plumb shallow commits as Option<NonEmpty<_>> through fetch argument building. |
| gix-protocol/Cargo.toml | Add nonempty dependency. |
| gix-odb/src/store_impls/dynamic/write.rs | Minor refactor using first() + improved expect message. |
| gix-odb/src/store_impls/dynamic/iter.rs | Use NonEmpty for loose ODB list in iterator state. |
| gix-odb/Cargo.toml | Add nonempty dependency. |
| gix-merge/src/tree/utils.rs | Use NonEmpty for TreeNodes internal storage. |
| gix-merge/src/commit/virtual_merge_base.rs | Make virtual_merge_bases non-empty by construction. |
| gix-merge/src/commit/mod.rs | Change commit-merge outcome merge_bases to Option<NonEmpty<_>>. |
| gix-merge/src/commit/function.rs | Adapt merge-base handling to NonEmpty APIs and conversions. |
| gix-merge/Cargo.toml | Add nonempty dependency. |
| gix-commitgraph/src/verify.rs | Adjust base-graph checksum iteration for NonEmpty storage. |
| gix-commitgraph/src/lib.rs | Make Graph.files non-empty. |
| gix-commitgraph/src/init.rs | Validate non-empty file list at Graph::new() construction. |
| gix-commitgraph/src/access.rs | Simplify object_hash() using non-empty invariant. |
| gix-commitgraph/Cargo.toml | Add nonempty dependency. |
| gitoxide-core/src/hours/mod.rs | Pass non-empty commit slices via split_first() to avoid empty handling. |
| gitoxide-core/src/hours/core.rs | Change estimate_hours() signature to accept an explicit first commit + rest. |
| Cargo.lock | Record nonempty crate resolution and propagated deps. |
0df2b93 to
0337144
Compare
…ix-merge` Adapt `gix` accordingly (even though it's nonbreaking). Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
0337144 to
76d230e
Compare
…mpty` in `gix-protocol` Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
83fd4b8 to
e033441
Compare
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.
Tasks